I observed a strange behavior with TCP connection.
In my solution I use TCP sockets for simple client-server command-response protocol. The messages are pretty short (up to 256 bytes) and are sent once every second. At the beginning of application sockets are created and are kept open for transmission. Client (the PC) sends message every one second and FreeRTOS device sends response.
However, once every 10-70 transactions the message is not sent. What is really interesting, the
FreeRTOS_send is called successfuly (and returns true), but this packet is not outputed to
xNetworkInterfaceOutput. What is even more interesting is that this message is being sent later, if any other communication occurs on this socket. But without poke from other side of the socket packet is delayed forever.
I also did some wireshark analysis. The transmission looks ok. Each packet from PC has ACK from FreeRTOS. If FreeRTOS decides to push my packet out - transmission to PC is also successful - ACK is sent back.
So the packet is sometimes delayed somewhere in the middle between
I also observed that after increasing priority of ip task, this is much less likely to happen (once every thousands).
This is not related to memory exhaustion (memory hwm never passes 30%) but could be caused by timing and scheduling. I also tested with no application logic (just pure os + ip stack), but results are the same.
STM32F107 + ENC28J60
TCP Windowing off
1 * mss tx & rx buffers
4 tx, 8 rx descriptors