In lwipopts.h

#define MEMP_MEM_MALLOC (4096)

What happens if you increase that?



On Sat, 20 Apr 2024 at 10:54 AM, Amit Rahman <amit.amit.rah...@gmail.com>
wrote:

> Hi all,
>
> I am working on a project using an STM32 Nucleo H563ZI board with lwIP and
> FreeRTOS, and I am facing some issues with the stability of the network
> stack.
>
> After running for a certain period (around 2-3 minutes), the board seems
> to crash or freeze, and I am looking for guidance on how to troubleshoot
> and resolve this problem.
>
>
> Here's a summary of my setup and findings:
>
>    1. Development environment:
>       - STM32 Nucleo H563ZI board
>       - lwIP and FreeRTOS integration
>       - Ethernet communication with a local router and computer
>       - Static IP configuration, firewalls disabled
>    2. Observations:
>       - The board runs normally for about 2-3 minutes before crashing or
>       freezing.
>       - When sending ping requests from the computer, the board responds
>       to about 30 pings before crashing, with an average round-trip time of
>       10.774 ms, Ethernet looptime of about 10ms
>       - Without ping requests, the board sends out around 45 messages
>       before crashing.
>       - The crash seems to occur during packet processing or memory
>       management.
>    3. Debugging findings:
>       - In the serial monitor, after the crash, I noticed the following
>       message: "pbuf_add_header: failed as 0x2002d244 < 0x2002d260 (not enough
>       space for new header size)"
>       - The debugger call stack gets stuck in a specific function
>       callstack where I suspect the assert fails.
>       - [image: image.png]
>       - Where the call stack is:
>
> tcip_try_callback (which is trying to call back pbuf_free_ooseq_callback)
> pbuf_pool_is_empty
> pbug_alloc
>
>    - The pbuf length keeps increasing, as seen in the serial monitor
>       logs: "ip4_input: p->len 84 p->tot_len 84" etc etc
>       -
>       - Relevant code:
>       - I have attached the relevant source files, including:
>          - udp.c
>          - ethernetif.c
>          - lwipopts.h
>          - lwipopts_freertos.h
>
> My guess is that upon receipt in ARP probe response from my computer to
> the board and/or the repeated ping requests from my computer, the stack
> eventually runs out of memory, and the pbuf chain length keeps increasing,
> however the issue with deallocating pbufs somewhere its not apparent to me.
>
>
> I suspect that there might be a misconfiguration in the lwIP setup or
> memory management, but I am unsure how to proceed with debugging and
> resolving the issue.
>
> I would greatly appreciate any guidance or suggestions on the following:
>
> I had mostly based my code on the UDP echoserver example
> https://github.com/STMicroelectronics/stm32h5-classic-coremw-apps/blob/main/Projects/NUCLEO-H563ZI/Applications/LwIP/LwIP_UDP_Echo_Server/Core/Src/main.c
>
> Unfortunately, I don't seem to see what I'm missing.
>
> Thank you in advance for your assistance. I look forward to your insights
> and recommendations.
> _______________________________________________
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to