2024-01-24 08:46 AM
I'm quite new to STM32, and I'm trying to get LwIP up and running on my NUCLEO-H723ZG. No matter what I've tried so far, my board has always goes into HardFault, specifically during MX_LWIP_Init(), when the HAL calls etharp_raw(). Here is the full call stack for reference:
Here are the lines of code in etharp.c in which the HardFault occurs:
etharp_request_dst():
etharp_raw():
These are the steps I followed so far:
I've also tried:
I'm quite lost on what could be the cause. Any help would be highly appreciated,
Marco
Solved! Go to Solution.
2024-01-25 09:24 AM - edited 2024-01-25 09:36 AM
> how to get more details in case of HardFaults?
This one is easy. The CubeIDE debugger has a Fault Analyzer tool (look for the bomb icon). When you get a hard fault, open it and it will expose useful details. For more info please look in CubeIDE used guide. Generally there's a lot of info about the HardFaults and how to analyze them.
http://efton.sk/STM32/Cortex_M4_faults.pdf from @Jan Waclawek
https://github.com/cturvey/RandomNinjaChef/blob/main/KeilHardFault.c from @Tesla DeLorean
2024-01-24 10:06 AM
Dump out the register set from the fault, and the instructions there.
My guess would be that ipsrc_addr is an accessible memory address, at all, or misaligned.
Start by looking at what it is the processor doesn't like, not shot-gunning a whole bunch of code, heap or stack changes.
Once you know specifically what the processor is objecting too, work backward from there, perhaps adding telemetry output or sanity checks.
2024-01-24 01:54 PM
Here is example that you can use for inspiration
https://github.com/stm32-hotspot/STM32H7-LwIP-Examples/tree/main/STM32H723_Nucleo_ETH
2024-01-24 02:17 PM
@Tesla DeLorean I will try tomorrow to get a register and instruction dump, I'll post it here since I don't have the knowledge to understand it completely.
@Pavel A. Yes, that is in fact the example I'm following made by @Adam BERLINGER and that I'm struggling to reproduce following his instructions, both in his post and in the README.
Can you point me to some guide or application note that describes how to get more details in case of HardFaults? Not knowing what's going on is becoming quite frustrating
2024-01-25 09:24 AM - edited 2024-01-25 09:36 AM
> how to get more details in case of HardFaults?
This one is easy. The CubeIDE debugger has a Fault Analyzer tool (look for the bomb icon). When you get a hard fault, open it and it will expose useful details. For more info please look in CubeIDE used guide. Generally there's a lot of info about the HardFaults and how to analyze them.
http://efton.sk/STM32/Cortex_M4_faults.pdf from @Jan Waclawek
https://github.com/cturvey/RandomNinjaChef/blob/main/KeilHardFault.c from @Tesla DeLorean
2024-01-26 01:26 AM - edited 2024-01-28 11:07 AM
I was finally able to find the dumb error that caused the fault, I didn't set one of the MPU regions's "TEX field level" to "level 1". Now the STM32 connects to ethernet and I can ping the board when using a static IP address or DHCP.
Thanks for the help.