System gets stuck in hardfault handler after sending few chunks with LWIP using FreeRTOS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-01-02 3:44 AM - last edited on 2025-01-02 3:49 AM by mƎALLEm
HELLO,
I’m facing a hard fault when transmitting large data (60,018 bytes) via LwIP TCP/IP on STM32H723 with FreeRTOS. After increasing buffers and adjusting lwipopts.h, only 4000-5000 bytes transmit successfully. Remaining data causes crashes, likely due to memory exhaustion, stack overflow, or incorrect buffer handling. Need help resolving this.
"cam_bsnet Debug [STM32 C/C++ Application]
THANKS IN ADVANCE
- Labels:
-
FreeRTOS
-
LwIP
-
STM32H7 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-01-02 5:05 AM
Probably overflowing the stack, or heap and stack are colliding. Look at the line that triggers failure (ethernet.c:113) and see where the buffer is being stored and verify it's not overwriting anything.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-01-03 1:46 AM
thanks, I did the changes suggested by you, now i am able to transmit the complete data but sometimes system gets stuck in Hard Fault Handler during start, i think there is some issue in "pxPortInitialiseStack() at port.c:214 0x8011334"-
Hard Fault Stack-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-02-17 8:39 AM
Hello @Arush ,
it seems that you are lacking proper buffer management, so you are running out of stack.
this is worth mentioning about LwIP memory management:
- LwIP provides a flexible way to manage memory pool sizes and organization.
- It reserves a fixed-size static memory area in the data segment. It is subdivided into the various pools that lwIP uses for the various data structures. As an example, there is a pool for struct tcp_pcb, and another pool for struct udp_pcb. Each pool can be configured to hold a fixed number of data structures. This number can be changed in the lwipopts.h file. For example, MEMP_NUM_TCP_PCB and MEMP_NUM_UDP_PCB define the maximum number of tcp_pcb and udb_pcb structures that can be active in the system at a given time.
- The user options can be changed in lwipopts.h.
Regards
