Skip to main content
Visitor II
May 19, 2022
Question

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

  • May 19, 2022
  • 1 reply
  • 1619 views

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?

    This topic has been closed for replies.

    1 reply

    Graduate II
    May 20, 2022

    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