Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

DAVE™ Forum Discussions

User11478
Level 1
Level 1
WireShark file:
(192.168.115.74 = XMC4500, 192.168.115.75 = PC)

XMC4500 Hexagon Board with Ethernet/CAN/RS485 Interface Card
DAVE 4.2.4
DAVE Apps webserver example with CMSIS RTOS, lwIP (stack and simple file system) and netconn
connected with Ethernet/USB adapter, micro usb cable and SEGGER J-Link usb cable to a PC

After implementing the XMC4500 Relax Kit webserver example from the DAVE Apps (xmc4500_relaxkit_lwip_httpserver_netconn) with correct ethernet ports on the XMC 4500 Hexagon and the file system from lwIP I get TCP Resets and TCP Retransmissions.
The webserver works great if only one TCP port is in parallel use (I tested is with a small html page and one picture).
But, if there are two pictures included and the two HTTP Requests coming to the XMC in short time in a row, I get a reset for the second HTTP Request, so the second picture is not loaded from the webserver.
When they appear not in a row with a bit more time difference both pictures are loading.
1st try -> bad: WireShark line 5 to 82, small picture didn't load, both HTTP Requests appear in a row (line 31 and 32), XMC4500 answer second Request (for small image) with two (???) resets
2nd try -> good: WireShark line 83 to 169, both Requests don't appear in a row (line 104 and 118), both pictures loaded
3rd try -> bad: WireShark line 170 to 208, both Requests appear again in a row (line 196 and 197), now the huge picture didn't load cause attendant Request is second
... this behavior continues for about 20 page reloads, then I get TCP Retransmissions (beginning line 1622) and the page loading lasts a few seconds.

Maybe you guys have any idea what is the problem here.
Thanks for your help.
0 Likes
2 Replies
User11478
Level 1
Level 1

Some (bad) news of our problem:
We have investigated the problem during the last few days but had no success.
First we thought the fsdata.c file system is the problem, because the guys from lwip forum wrote that it's not thread-safe, but using the lock function for the lwIP TCPIP thread didn't help.
To verify that the file system isn't the problem, we used only the DAVE Apps 4 webserver example xmc4500_relaxkit_lwip_httpserver_netconn (v4.2.4) on two XMC4500 (Hexagon and a pcb with chip on it) and integrated the images as Base64 code in the C code instead of a file system with external files.
Now, the website consists only of HTML code and needs only one TCP port. That works great without any problem.

code for image integration: insert images as chars above and send them with netconn_write() in the http_server_netconn_serve() function
const static char image_1[] = "";
netconn_write(conn, image_1, sizeof(image_1)-1, NETCONN_NOCOPY);

But, if we do a stress test with several browser tabs and auto refresh we're getting the same TCP resets and later the same TCP retransmissions, as you can see in the attached WireShark file.
In the first part (line 1 to 41000), each time when a second parallel TCP port is started (next browser request) and the XMC wants to read and transmit the requested data it throws a reset. (Is that a normal behaviour?)
In the second part (41000 to end) some strange delays occur (line 40992 and 40995 - between XMC getting ACK and sending new data 700ms, line 41005 and 41008 - same problem 90ms and so on) which didn't occur in then first part.
Then, the delays getting so big that the XMC sends TCP data packets twice, probably because the controller didn't get the ACK before a timeout timer ran out.
Later, many more dubious retransmissions occur and loading the website lasting longer and longer until the website can't reload anymore.

It seems that problem occurs almost randomly (we did a few stress tests with 6 browser tabs and auto refresh every 5 seconds, after 4 to 6 minutes the retransmissions occur) and we have no idea what to do.
Maybe one of you could check that DAVE Apps Webserver on your own XMC4500 and report if you have the same problems, that would help us a lot 🙂

Edit: Even with the small Hello World page "Welcome to our lwIP HTTP server! This is a small test page, served by httpserver-netconn" in a few parallel browser tabs with auto refresh we get TCP retransmissions after a few minutes.
0 Likes
Not applicable
HI Michael,

Thank you for reporting this. We have modified the code and updated the example.

Find attached an updated project which passed the stress conditions stated by the user.
Changes:
- Update to latest LLD implementation which avoids extra copy of buffers
- Memory settings: More tasks are defined to accept the incoming requests.
> xmc_eth_mac.c: Changed XMC_ETH_MAC_ReturnTxDescriptor and XMC_ETH_MAC_ReturnRxDescriptor
> xmc_eth_mac.h: Added XMC_ETH_MAC_GetTxBuffer() and XMC_ETH_MAC_GetRxBuffer() , Added XMC_ETH_MAC_SetTxBufferSize()


Please let me know if any further help is needed.

Regards,
Daryl
0 Likes