UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor dhthomas
Visitor
7,860 Views
Registered: ‎08-18-2008

FreeRTOS + lwip + Zynq EMACPS Receive Halts SDK 2015.3

I'm using the Zynq FreeRTOS BSP in SDK2015.3 with lwip enabled on a ZC02 dev board.. lwip is configured to run in socket mode, and I've been able to get lwip to run using XAPP1026 for how to init the stack and set up the receive packet thread.

 

I can ping the board... for a while. After exactly 2*n_rx_descriptors-1 (a variable in the BSP options for LWIP, under temac_adapter_options), the app stops processing incomming packets. I've been able to adjust n_rx_descriptors, and the behavior scales perfectly with this variable.

 

Has anyone experienced this type of behavior before?

0 Kudos
4 Replies
Visitor jcarcheri
Visitor
7,810 Views
Registered: ‎12-01-2015

Re: FreeRTOS + lwip + Zynq EMACPS Receive Halts SDK 2015.3

I am experiencing the same exact issue and can replicate your behavior. I also get the behavior on a custom board. Contrary to you, I am using lwIP in Raw mode so it looks like the issue is for both. The same behavior occurs if I eliminate my app and just use the simple lwIP Echo Server application template that comes built into the SDK.

 

I've attempted to revert the emacps and lwip bsp files from 2015.1 SDK edition with no success. The problem still occurs. I will let you know if I find out anymore or have a solution.

 

0 Kudos
Visitor jcarcheri
Visitor
7,794 Views
Registered: ‎12-01-2015

Re: FreeRTOS + lwip + Zynq EMACPS Receive Halts SDK 2015.3

I’ve also noticed that the problem goes away if I change the compiler options for the BSP code and turn off optimization. I do this by navigating to the BSP Settings (Right-click on your BSP -> Board Support Package Settings). Click Overview -> Drivers -> CPU -> Extra Compiler Flags. In the Extra Compiler Flags, I added -O0 to turn off optimization.  This option overwrites the -O2 default setting.

0 Kudos
Visitor jcarcheri
Visitor
7,792 Views
Registered: ‎12-01-2015

Re: FreeRTOS + lwip + Zynq EMACPS Receive Halts SDK 2015.3

After some more research online this morning, there is a documented issue with the Xilinx SDK 2015.3 lwIP adapter code (see link below). The topic of AR #65592, although seemed to indicate a different issue and behavior, seemed to be worth a try. I’ve applied the patch published by Xilinx to my echo server project’s BSP running on the ZC706 and no longer get the lwIP halts when pinging. The compiler optimization setting is also set back to the default of -O2. The patch adds two ARM Data Synchronization Barrier (DSB) instructions in the Ethernet MAC PS DMA interface code. DSB acts as a special kind of memory barrier. No instruction in program order after this instruction executes until this instruction completes. This would definitely prevent the compiler from optimizing those parts of code. I’ve also applied the patch to run on our custom board and all seems ok so far. According to the AR, the next SDK version (2015.4) will contain this patch built in. I hope this helps!

 

http://www.xilinx.com/support/answers/65592.html

 

0 Kudos
Visitor dhthomas
Visitor
7,787 Views
Registered: ‎08-18-2008

Re: FreeRTOS + lwip + Zynq EMACPS Receive Halts SDK 2015.3

I started diving into the driver code and it looks like optimization is eliminating or rearranging some of this code section of setup_rx_bds() in xemacpsif_dma.c:

 

temp = (UINTPTR *)rxbd;

*temp = 0;

if (bdindex == (XLWIP_CONFIG_N_RX_DESC - 1)) {

*temp = 0x00000002;

}

temp++;

*temp = 0;

 

I was able to get it working by adding the volatile keyword to the temp declaration. I then found the same AR that you did which seems like a more robust solution.

0 Kudos