2023-08-08 2:33 PM - edited 2023-08-08 2:36 PM
I have a project running on my Stm32H7. I imported my ethernetif/lwip settings from the Stm32CubeH7 H723 lwip + freertos http server example, but made some small changes. For the most part in the most basic sense, the driver works and my board at least gets a DHCP lease and responds to ping, but I am getting an assert:
"Assertion "pbuf_free: p->ref > 0" failed at line 753 in [......]/LwIP/src/core/pbuf.c"
I've read so many topics on the state of Ethernet in the Stm32H7. Because of the ST community manager locking threads where fixes are discussed, I honestly don't know the current state of the drivers, except I can guess that this is an issue having to do with pbufs getting clobbered. I've seen the large zip file from https://community.st.com/t5/embedded-software-mcus/bug-fixes-stm32h7-ethernet/td-p/281420, but I don't know how out of date this is or how many of these issues have truly been fixed now.
If the drivers in the CubeH7 drivers are working, what am I doing wrong? If they are not, when can we expect better fixes? The Stm32H7 has been out for 6+ years.
Thanks!
Attached are my files:
NOTE: In my code, D/ICACHE are enabled in main
Solved! Go to Solution.
2023-08-23 6:09 PM
Thanks @STOne-32 , I will follow up with them.
2023-10-12 6:39 AM
Do you have any solution? I have exactly the same problem with pbuf assert.
2023-11-02 8:41 AM
Any update ? I have the exact same problem.
2024-02-10 7:22 AM
hi, i am also facing similar problem. did you get the solution? could you help ?
Sankar
2024-02-10 8:56 AM
2024-02-12 10:25 AM
Hello @Sankar ,@dumarjo, @kotofey,
I can confirm that this issue is related mostly to buffer sizes exceeding their dedicated memory addresses and this addressees can change based on the H7 series and if it's a dual or single core MCU . i don't know you exact issues but you can try to look for the following common mistakes:
a detailed explanation on the setup of Ethernet and LWIP on STM32H7 can be found in this article .
BR
2025-07-11 12:30 PM
If you have any memory issues wit lwip and FreeRTOS you should keep in mind that lwip is not thread safe by default. Netapi should be thread safe, but if you are using any other lwip functionality from multiple threads you should know what you are doing.
I recommend to move all network related tasks to the same priority as TCP/IP task and disable time slicing to see if it solves your issues. You can also test disabling all tasks calling lwip function to see if it helps.