cancel
Showing results for 
Search instead for 
Did you mean: 

LwIP tcp_write() function returns ERR_MEM after running for a while

AJose.2
Associate II

I am running a tcp server in STM32H753 MCU using LwIP driver. LwIP raw APIs are used for setting up the server. The server is sending a packet of size 200 bytes every 200ms.Ther server is connected to a single client(application running on an linux PC) The server is working properly for around 5-6 hours until the tcp_write() function returns a ERR_MEM. I have verified the return value of tcp_sndbuf() and the there is enough space in the queue. Is there any other condition when tcp_write() function throws ERR_MEM? Is there any other condition I'm overlooking?

1 REPLY 1
Piranha
Chief II

So are you now using the newest HAL drivers? I wrote a very important comment regarding the HAL ETH driver versions in the previous topic...

Also are you using RTOS? If so, using lwIP RAW APIs require using lwIP core locking. And even, when you do it, CubeMX generated code will not respect multi-threading requirements anyway.

https://community.st.com/s/question/0D50X0000BOtfhnSQB/how-to-make-ethernet-and-lwip-working-on-stm32