cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Participant
Participant
8,438 Views
Registered: ‎04-14-2010

xemac_add hangs in lwip_echo_server

Hello,

 

I have a design working well with XPS/SDK 12.1.  The xps_Ethernets worked fine.

 

When I upgrade to 13.4 (mainly to use the lwip1.4) with the same code, the code hangs at xemac_add() function call.  I can't even make the lwip_echo_server application come with the SDK13.4 work.  The program just hang at xemac_add(). 

 

I spent a few days to search from the forums and xilinx website. It seems this issue happened for other people too.  It seems never be solved (or I missed the link). People made the code work by adjusting the stack/heap size, by changing the base address of the xps_ethernetlite. Some people get the xemac_add work, some don't.  For me, I tried the above tricks, still can't get the xemac_add() work for the  lwip_echo_server in the SDK.  My peripheral_tests application in SDK shows the Ethernet port is working and the interrupt is working.

 

If someone knows the solution (from the forums or from Xilinx) for this issue, please help me on this.  I am stuck on this issue.

 

Thanks a lot,

 

Tom

 

 

 

 

 

 

0 Kudos
6 Replies
Highlighted
Voyager
Voyager
8,430 Views
Registered: ‎02-10-2012

Hello Tom!

 

I think I understand your problem. Not too long ago I had a similar situation. First of all you have to get into the debugger to find out exactly where the code hangs. It might be possible that it is in an infinite while loop!


I am just taking a shot in the dark here : For me the reason it was getting stuck was because of the link speed configuration. The default setting for the temac_adapter for the link speed is set to AUTO in the LWIP configuration settings in the BSP. This works only with some special PHY interfaces on the board such as the Marvel PHY. Auto link speed detection might not be supported in your PHY interface on the board. I suggest you set it to 100 Mbps or 10 Mbps depending on the type of your design. Also note that 1 Gbps is not supported in Ethernet_lite interface. Try to set the link speed and see if the program executes well.

 

When I debugged the program I found out this was the problem. Hopefully this will help you. If not we can try other methods. If this does not work , please post more information related to the design so that you may have a higher chance of people helping you.

 

Regards

Arvind

0 Kudos
Highlighted
Participant
Participant
8,420 Views
Registered: ‎04-14-2010

Hi Arvind,

 

Thank you so much for the reply. I am using Ethernet_lite and Micrel's KSZ8041NL as the PHY chip. I didn't where to set the link speed for Ethernet_lite in lwip config page in the BSP setting page.  There is one link-speed setting for temac_adapter_options.  I tried to set the link speed to 100 and 10 Mbps, the lwip_echo applicaiton still hangs at xeamc_add( ) call. I didn't debug the lwip functions yet.  Do you know other possible reason for this issue for my case ?  I tried on XPS/SDK 14.1 and got the same results (hangs at xeamc_add).

 

I am attached the .mss file for the lwip_echo_server.

 

Thanks again for the help.

 

Tom

 

 

--------------------system.mss for lwip_echo_server--------------------------


 PARAMETER VERSION = 2.2.0


BEGIN OS
 PARAMETER OS_NAME = standalone
 PARAMETER OS_VER = 3.05.a
 PARAMETER PROC_INSTANCE = microblaze_0
 PARAMETER STDIN = xps_uartlite_0
 PARAMETER STDOUT = xps_uartlite_0
END


BEGIN PROCESSOR
 PARAMETER DRIVER_NAME = cpu
 PARAMETER DRIVER_VER = 1.13.a
 PARAMETER HW_INSTANCE = microblaze_0
END


BEGIN DRIVER
 PARAMETER DRIVER_NAME = bram
 PARAMETER DRIVER_VER = 3.01.a
 PARAMETER HW_INSTANCE = dlmb_cntlr
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = bram
 PARAMETER DRIVER_VER = 3.01.a
 PARAMETER HW_INSTANCE = ilmb_cntlr
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = uartlite
 PARAMETER DRIVER_VER = 2.00.a
 PARAMETER HW_INSTANCE = mdm_0
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = mpmc
 PARAMETER DRIVER_VER = 4.01.a
 PARAMETER HW_INSTANCE = mpmc_0
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = generic
 PARAMETER DRIVER_VER = 1.00.a
 PARAMETER HW_INSTANCE = psc_0
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = emaclite
 PARAMETER DRIVER_VER = 3.03.a
 PARAMETER HW_INSTANCE = xps_ethernetlite_0
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = intc
 PARAMETER DRIVER_VER = 2.04.a
 PARAMETER HW_INSTANCE = xps_intc_0
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = spi
 PARAMETER DRIVER_VER = 3.04.a
 PARAMETER HW_INSTANCE = xps_spi_0
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = tmrctr
 PARAMETER DRIVER_VER = 2.04.a
 PARAMETER HW_INSTANCE = xps_timer_0
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = uartlite
 PARAMETER DRIVER_VER = 2.00.a
 PARAMETER HW_INSTANCE = xps_uartlite_0
END


BEGIN LIBRARY
 PARAMETER LIBRARY_NAME = lwip140
 PARAMETER LIBRARY_VER = 1.01.a
 PARAMETER PROC_INSTANCE = microblaze_0
 PARAMETER API_MODE = RAW_API
 PARAMETER PHY_LINK_SPEED = CONFIG_LINKSPEED100
END

 

0 Kudos
Highlighted
Participant
Participant
8,407 Views
Registered: ‎04-14-2010

I found the issue is the lwip1.4.0/xilinx adapter has auto-negotiated link turn on. It doesn't work if I connect my device with a Gbps port of a PC.  If I connect the device to a slower 100Mbps switch, the auto-negotiated works and xemacs_add()/lwip_echo_server works !   I don't know how to turn off the auto-negotiation for xps_ethernetlite.  The lwip config page only give the choised for temac_adapter_options. 

 

If anyone knows how to turn off the auto-negotiation for xps_ethernetlite for lwip1.4.0, please help me.

 

Thanks.

 

Tom

 

 

0 Kudos
Highlighted
Voyager
Voyager
8,401 Views
Registered: ‎02-10-2012

Hey Tom!

 

Yes this was another Issue I faced an year back. Forgot about this scenario. As you might have known by now the Ethernet_lite IP does not support 1GBps speed ( Clearly mentioned in the documentation ).

 

I am not entirely sure about what I am about to say but it is my understanding that the temac_adapter_option in the BSP settings is what determines the link speed. So if you set it to a fixed value like 100 mbps and not auto link speed , it establishes a connection at 100 mbps and does not auto negotiate.

 

A good way to test this theory is to set the temac_adapter option to 100 Mbps and connect your board to a 1 Gbps switch box. That way it will establish the speed to 100 Mbps  and not 1 Gbps because you have specified so in the BSP option.

 

Bottom line is : I believe the lwip stack is what determines the link speed and is controlled by the parameters you set in the BSP settings and not the settings of the xps_ethernetlite.

 

Unfortunately I cannot test my theory at the moment because I am involved with another project that needs a lot of work to be done.

 

If you are still working on this project , you can try this test and share the outcome.

 

Regards

Arvind

0 Kudos
Highlighted
Participant
Participant
8,395 Views
Registered: ‎04-14-2010

Hi arvindnr,

 

Thanks for the kind reply.

 

I understand that the xps_ethernetlite doesn't support 1Gbps. I tried to set the temac_adapter to 100Mbps and found the auto-negotiation still doesn't work. I think this setting only control the temac, not the xps_ethernetlite. For Lwip 1.3, the problem doesn't exist.

 

My work around is: if I am connecting my device directly to a PC, I force the PC to use 100Mbps speed.  If I am connect to a 100Mbps switch,  the device works fine by itself.   Fortunately, my device is always connected to a 100Mbps switch (since I knew xps_ethernetlite doesn't go to 1Gbp).  Occasionally when I debug the device, I need to connect it directly to a PC. So, for me, the workaround is ok.

 

Thanks for the help.

 

Tom

 

0 Kudos
Highlighted
Voyager
Voyager
8,390 Views
Registered: ‎02-10-2012

Thank you for posting your findings. I will invistigate a bit more into this when I can. I am glad you have a work around.

 

Regards

Arvind

0 Kudos