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: 
Highlighted
Contributor
Contributor
371 Views
Registered: ‎06-20-2018

LwIP connection lost after long wait - revised with lots of details. pls help

Jump to solution

Hello 

 

We are developing DSP system based on ZCU102 and we are facing a critical problem related to LwIP. 

The system is using LwIP (no OS) on ZCU102. The main.c section code is based echo server example as below

start_server();

/* receive and process packets */


if (TcpFastTmrFlag) {
				tcp_fasttmr();
				TcpFastTmrFlag = 0;
			}
			if (TcpSlowTmrFlag) {
				tcp_slowtmr();
				TcpSlowTmrFlag = 0;
			}

			xemacif_input(echo_netif);
			transfer_data();

 

In the main.c, start_server() starts our own application, which decodes input data received from Ethernet and triggers a number of functions on the FPGA. As an example, it can program the memory, read hardware status and perform signal processing. At the end of each command, the code returns back to the main section and keeps waiting for incoming data (which is sent by MATLAB user application). Pls see pseudo-code below for reference

switch data_in

case 0

update_memory();

break;

case 1

dump_state();

break;

case 2

processing();

break;

Our code is working in most cases. However, there is one particular case it does not work. In switch case 2, ZCU102 is asked to execute DSP. If the time to execute the desired DSP function is short (5 to 10 secs), the LwIP connection is fine between FPGA and PC. The connection betweelo client (MATLAB) and server (FPGA) remains open. 

 

However, if the time takes longer than 20 seconds, I can't receive any data sent from FPGA. What happens is that I need to reset the tcp connection at MATLAB side and re-open a new TCP connection. We did signficant debugging and confirmed that the problem is not caused by MATLAB. When the main loops waits for over 20 secs, it seems that LwIP PCB is 'inactive'/

 

I suspect it has something to do with timer but I have no clue how to solve it.

 

Can anyone advise on this?

 

Thank you

0 Kudos
1 Solution

Accepted Solutions
Adventurer
Adventurer
316 Views
Registered: ‎04-07-2014

Re: LwIP connection lost after long wait - revised with lots of details. pls help

Jump to solution

Hi,

The TcpFastTmrFlag is usually triggered every 250ms and LWIP expects you to call tcp_fasttmr() and tcp_slowtmr() accordingly. When your main loop is busy for several seconds doing other stuff, than LWIP will get confused.

I recommend, that you split your time consuming functions to be able to fulfill LWIP function call timing requirements.

Hope, that answers your question, please leave Kudos if this is the case.

:-)

Regards,

Sebastian

2 Replies
Adventurer
Adventurer
317 Views
Registered: ‎04-07-2014

Re: LwIP connection lost after long wait - revised with lots of details. pls help

Jump to solution

Hi,

The TcpFastTmrFlag is usually triggered every 250ms and LWIP expects you to call tcp_fasttmr() and tcp_slowtmr() accordingly. When your main loop is busy for several seconds doing other stuff, than LWIP will get confused.

I recommend, that you split your time consuming functions to be able to fulfill LWIP function call timing requirements.

Hope, that answers your question, please leave Kudos if this is the case.

:-)

Regards,

Sebastian

Contributor
Contributor
312 Views
Registered: ‎06-20-2018

Re: LwIP connection lost after long wait - revised with lots of details. pls help

Jump to solution

Thank you very much for the comment! 

 

We are working to implemet the DSP more efficiently currently. A temporary fix is to split the DSP load into chunks. 

0 Kudos