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: 
Observer samuelcotard
Observer
2,298 Views
Registered: ‎06-12-2015

lwIP echo server generates trap error

Jump to solution

Hello,

 

I faced an issue in the lwIP echo server (2015.4) example that takes me a lot of time.

 

tcp_outpout() accesses and modifies the pbuf global variable used by the whole lwIP stack. But tcp_output() is called both from the application and from interrupt routine tcp_tmr()->tcp_fasttmr().

In the lwIP stack there is no protection against interrupts when accessing the pbuf thus it is forbidden to call tcp_output() in an interrupt as it corrupts the pbuf global variable.

 

The solution is to call tcp_tmr() in the main() loop  according to a flag/variable indicating the timer's overflow. This flag can be set in the interrupt routine. 

 

The issue occurs very often in high throughput applications but can occur randomly in any application.

 

I hope it can help other users to improve their application's reliability and Xilinx to improve the example code.

 

Regards,

 

Samuel

0 Kudos
1 Solution

Accepted Solutions
Observer samuelcotard
Observer
3,236 Views
Registered: ‎06-12-2015

Re: lwIP echo server generates trap error

Jump to solution

The solution is to call tcp_tmr() in the main() loop and not in the interrupt routine.

View solution in original post

0 Kudos
2 Replies
Observer samuelcotard
Observer
3,237 Views
Registered: ‎06-12-2015

Re: lwIP echo server generates trap error

Jump to solution

The solution is to call tcp_tmr() in the main() loop and not in the interrupt routine.

View solution in original post

0 Kudos
Observer samuelcotard
Observer
1,637 Views
Registered: ‎06-12-2015

Re: lwIP echo server generates trap error

Jump to solution

What is amazing is that it seems to be a known issue for Xilinx. Why old code is implemented in new releases?

https://forums.xilinx.com/t5/Embedded-Development-Tools/lwip-crashing-after-several-days-of-runtime/m-p/399183/highlight/true#M29700

 

0 Kudos