cancel
Showing results for 
Search instead for 
Did you mean: 

HardFault_Handler when enable LWIP and touchgfx

MauFanGilaMedical
Associate III

Hello guys.

 

I've bought Riverdi 12.1” board that mounts STM32H757XIH6.

 

I developed graphic part and I use uSD, and USB Mass-Storage without any problems.

 

I use FreeRTOS and FatFS.

 

Now it's time to use Ethernet, so I bought PoE - Riverdi, enabled LWIP library following instructions on the video How to use Ethernet on Riverdi STM32 Embedded Displays || PoE Add-on.

 

I set MX in this way:

MauFanGilaMedical_0-1746012830072.pngMauFanGilaMedical_1-1746012861994.png

 

MauFanGilaMedical_2-1746012895732.pngMauFanGilaMedical_3-1746012927438.png

The linker script

 

MauFanGilaMedical_4-1746012987404.png

ethernetif.c

MauFanGilaMedical_5-1746013035117.png

 

I compiled and I connect ethernet cable and it seems work poperly because if I ping I obtain right answer,

 

but! sometimes processor goes to HardFault

 

I've writed simple TCP server that accept connection on port 100 and send "Hello" every second.

 

MauFanGilaMedical_7-1746013397900.png

 

When I try to connect with TERA TERM it goes immediately on HardFault.

 

MauFanGilaMedical_8-1746013683113.png

 

Here the code of ethernet_input

 

MauFanGilaMedical_9-1746013734859.png

 

 

Can someone Help me ?

 

Thankyou in advance

 

 

 

 

 

 

 

 

 

 

 

 

 

 

11 REPLIES 11
MauFanGilaMedical
Associate III

Today it goes to HardFault from __ISB or __DSB:

 

Stack for __DSB

 

MauFanGilaMedical_2-1746450766626.png

 

 

MauFanGilaMedical_5-1746450838659.png

 

 

MauFanGilaMedical_4-1746450812591.png

 

 

 

And stack for __ISB

 

MauFanGilaMedical_7-1746451154312.png

 

MauFanGilaMedical_8-1746451174105.png

If could be helpful the CFRS is IMPRECISERR

 

 

MauFanGilaMedical_9-1746454861812.pngMauFanGilaMedical_10-1746454877469.png

 

MauFanGilaMedical_11-1746455064228.png

 

 

MauFanGilaMedical
Associate III

I observe that memp_memory_RX_POOL_base is at 0x30000400 and its size is 18,38KB, so memp_memory_RX_POOL_base spans in 0x30000400..30004BCC.

 

Starting from this I set LWIP_RAM_HEAP_POINTER to 0x30005000 because I suspect that memp_memory_RX_POOL_base overlaps LWIP_RAM_HEAP_POINTER.

 

MauFanGilaMedical_0-1747043448244.png

 

Then I go to MPU and increase MPU Region 1 Size from 16K to 64K because it started from 0x30000400 and its size is 0x30005000-0x30000400+14KB

 

MauFanGilaMedical_1-1747043546431.png

 

Subsequently I increase INTERFACE_THREAD_STACK_SIZE from 350 to 1KB ..

 

MauFanGilaMedical_2-1747043744474.png

And I increase that stack of Server thread from 1KB to 10KB (even if I want to undersand how to reduce it to a minimum necessary size)

 

With this change the Server works without MCU crash... I observed one/two crashes and I'm still investigating.

 

I notice that when I send packets from PC to MCU sometimes MCU crashes