cancel
Showing results for 
Search instead for 
Did you mean: 

System gets stuck in hardfault handler after sending few chunks with LWIP using FreeRTOS

Arush
Associate

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.

HARD FAULT STACK-
"cam_bsnet Debug [STM32 C/C++ Application]
cam_bsnet.elf [cores: 0]
Thread #1 [main] 1 [core: 0] (Suspended : Signal : SIGTRAP:Trace/breakpoint trap)
HardFault_Handler() at stm32h7xx_it.c:113 0x8002070
<signal handler called>() at 0xfffffffd
ethernet_input() at ethernet.c:113 0x8023328
tcpip_thread_handle_msg() at tcpip.c:174 0x801714e
tcpip_thread() at tcpip.c:148 0x8017102
pxPortInitialiseStack() at port.c:214 0x8012ab0
arm-none-eabi-gdb (13.2.90.20230627)
ST-LINK (ST-LINK GDB server)"

THANKS IN ADVANCE

2 REPLIES 2
TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".

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-

cam_bsnet Debug [STM32 C/C++ Application]
cam_bsnet.elf [cores: 0]
Thread #1 [main] 1 [core: 0] (Suspended : Signal : SIGTRAP:Trace/breakpoint trap)
HardFault_Handler() at stm32h7xx_it.c:112 0x8001e2c
<signal handler called>() at 0xfffffffd
ethernet_input() at ethernet.c:113 0x8021bb4
tcpip_thread_handle_msg() at tcpip.c:174 0x80159d6
tcpip_thread() at tcpip.c:148 0x801598a
pxPortInitialiseStack() at port.c:214 0x8011334
arm-none-eabi-gdb (13.2.90.20230627)
ST-LINK (ST-LINK GDB server)
Need help resolving this.