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
TDK
Super User

Cuold be insufficient stack size.

Look at the ethhdr pointer and ensure it's valid. If it's not, set up a hardware watchpoint to see where and when it's changed.

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

Yes TDK I watch the address: is 0x28000045

 

MauFanGilaMedical_1-1746016800628.png

 

 

and ethhdr->type is 0x24001b64

 

MauFanGilaMedical_2-1746016856829.png

 

how to increase stack size for tcpip_thread ? maybe TCPIP_THREAD_STACKSIZE ?

 

MauFanGilaMedical_0-1746017312561.png

 

 

 

 

MauFanGilaMedical_0-1746018284243.png

 

it seems msg->msg.inp.p point to invalid address: 0x28 ... 

 

MauFanGilaMedical_1-1746018424563.png

 

No RAM @ 0x28...

MauFanGilaMedical_2-1746018478517.png

 

 

 

 

what do you intend ?  set up a hardware watchpoint to see where and when it's changed

how can I see whene it's changed ?

MauFanGilaMedical
Associate III

Another question that I want to higlight, counld be that I have not enabled D-Cache ?

 

MauFanGilaMedical_0-1746023204862.png

 

TDK
Super User

Here's how to set a watchpoint:

https://community.st.com/t5/stm32cubeide-mcus/how-to-add-the-watchpoint/m-p/310217/highlight/true#M16720

You want to watch for the pointer to change, so add &ethhdr as the expression.

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

Hello @MauFanGilaMedical ,

 

Have you increase the stack size from STM32CubeMX as you show on one of your messages ?

Are you able to make the PoE (and ethernet in general) work without TouchGFX (or other implementations) ?

Can you check that the types on line 113 match, also check that ethhdr->type is properly initialized ?

Have you enabled your watchpoint ?

Not enabling D cache should not be an issue.

You could also ask for help on the Riverdi forum, maybe they have more informations.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Watchpoint is disabled maybe ethhdr is a local variable 

 

MauFanGilaMedical_0-1746425125783.png

 

MauFanGilaMedical
Associate III

When I go to HardFault I shot the stack and see if one thread stack overlap the next but I don't see this situation

 

MauFanGilaMedical_1-1746430421121.png

 

MauFanGilaMedical_0-1746430380489.png