Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20707 Discussions

communication ethernet between two FPGAs

Altera_Forum
Honored Contributor II
1,719 Views

Hi to all, 

I'm a new member of this forum, which, I'm sure, will be very usefull for my problem. 

So, I'm working with two Cyclon II fpga connected each other by the ethernet cable and 

I'm trying to develope a simple application able to exchange packets from a board to the other one. 

I'm using the NicheStack TCP/IP stack to deal with this matter, but, I get stuck when this latter starts the initialization. 

In fact, even if the two tasks "inet main" and "clock tick" work properly, the global variable "iniche_net_ready" which says whether the initialization has been done or not, is never set to "true". 

Are there someone who has experience in this stuff?? 

thank you in advance. 

Dario982
0 Kudos
9 Replies
Altera_Forum
Honored Contributor II
731 Views

Go to mysupport section of the altera WEB page and file a support question. 

 

Or also try the NIOS Forum link, as you might find a solution there.
0 Kudos
Altera_Forum
Honored Contributor II
731 Views

try put a hub with a dhcp server in between in stead of the (presumably) crossed cable which you, judging from your mail, are using right now. Or isnt it crossed, in which case it wont work?

0 Kudos
Altera_Forum
Honored Contributor II
731 Views

Thank you, 

actually I'm working with a switch enabled to the auto_negotiation. The problem is that the fpga seems to properly performs the auto_negotiation but It cannot go on because it is not able to set the IP adrress even if I manually set it as explained in the Simple Socket Server example providerd by Altera.  

The message I get from the console is the following: 

 

 

Your Ethernet MAC address is 00:07:ed:0f:09:9b 

Static IP Address is 192.168.1.234 

prepared 1 interface, initializing... 

Created "Inet main" task (Prio: 2) 

Created "clock tick" task (Prio: 3) 

[my message: waiting for iniche_net_ready...] 

smsc91c111 Auto-negotiation: 100 Mbps, Full Duplex 

SMSC ethernet Rev: 0x3392, ram: 8192 

IP_INIT ERROR: can't alloc route table 

ip_exit: calling func 0x300312b0 

netclose: closing iface SMSC 9100 series ethernet 

ip_exit: calling func 0x30013a64 

inet startup error: unable to initialize IP 

dtrap - needs breakpoint 

panic: IP 

ip_exit: calling func 0x0 

ip_exit: calling func 0x0 

 

 

As one can see, the IP address is (apparently) set but the error is still on the IP initialization. However I have also say that sometimes I dont get this IP_INIT error but it stops just after the message: 

smsc91c111 Auto-negotiation: 100 Mbps, Full Duplex 

SMSC ethernet Rev: 0x3392, ram: 8192 

 

The static IP assignment is done bye the same get_ip_addr() definition used in the Simple Socket Server example. The system used is a full featured and the environment is the quartus 7.1. 

 

If I attach the code, does anybody read it? 

thank you.
0 Kudos
Altera_Forum
Honored Contributor II
731 Views

Seems you lack free memory: From file ip.c 

you see... 

 

--- Quote Start ---  

#ifdef IP_ROUTING 

/* alloc space for the route table */ 

rt_mib = (struct RtMib*)RT_ALLOC(ipRoutes * sizeof(struct RtMib)); 

if (!rt_mib) 

# ifdef NPDEBUG 

dprintf("IP_INIT ERROR: can't alloc route table\n"); 

# endif /* NPDEBUG */ 

return(ENP_NOMEM); 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
731 Views

thank you, this is a very useful help. 

I was looking for the same peace of code. Sorry I'm not so much experienced. 

As you know, what is the memory involved in this RT_ALLOC instruction?  

Is it possible that the lack of memory is due to the fact that I'm using the full featured version (wich is, I guess, memory-starving)?? Or maybe I can improve the memory capacity somehow? 

Can you help me on that? 

Thank you once again.
0 Kudos
Altera_Forum
Honored Contributor II
731 Views

This memory is certainly allocated on the heap. The heap would also hold you static storage and global storage. This is allocated at link time before any alloc() gets a chance to have a bite of the cake. Check what you are allocating there. Maybe you can slim down somewhere.

0 Kudos
Altera_Forum
Honored Contributor II
731 Views

Is there any way to know where the heap is implemented and what I am allocating there? 

Actually my application is still very little, and there are hundreds of files inside the syslib allocating something. Then, do you think it is possible to fix the problem freeing some memory space? Like using, for instance, the "standard" sopc model instead of the "full featured" one?  

When I tried the socket server example I used the full featured and I didn't have any problem.
0 Kudos
Altera_Forum
Honored Contributor II
731 Views

you setup the heap ram in the system properties page. I think its not a problem of full featured or not you are facing. And syslib is maze, but there is no reason it should not work in your project, when it works in socket_server. 

 

Compare the system proporties from socket_server with your problem projects ditto. 

 

You can get a description of how to generate a linker map here: http://forum.niosforum.com/forum/index.php?showtopic=312

 

Make a search in the forum and you will find a lot of information, but in fact I prefer to use google. Just include "nios forum" in your search key. By the way, your problem is more related to niosforum.com than to this here.
0 Kudos
Altera_Forum
Honored Contributor II
731 Views

Do you know if the initialization of the Interniche TCP/IP stack dipends 

also from the socket management? 

Differently from the simple socket server example where a connection is 

establish, I'm tring to use a SOCK_DGRAM communication then I don't manage 

the structure (called SSSConn) for the connection. 

What do you think. 

Thank you.
0 Kudos
Reply