2024-10-03 6:29 AM
Hi,playing around a program found hard fault handler on debugging Can anyone help to proceed that
2024-10-03 6:43 AM - edited 2024-10-03 6:44 AM
https://community.st.com/t5/stm32-mcus/how-to-debug-a-hardfault-on-an-arm-cortex-m-stm32/ta-p/672235
2024-10-03 7:35 AM - edited 2024-10-03 7:37 AM
Look at what's actually faulting.
Most likely bad address or point, or misalignment. The CM0(+) do not tolerate misaligned 32-bit access.
Have a handler that outputs actionable detail, this is NOT done with a while(1) loop.
You can inspect the registers and stack in the debugger, but it's not nearly as helpful as printing something out, especially in the field or end-users, who aren't going to have access.
Instrument your code so you've got some first idea as to where it's going, what it's doing, and where it is failing.
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.