Dear all,
I am developing a project based on the LPC5526 processor.
Sometimes, during debugging, a HARDFAULT_HANDLER exception is generated, as shown in the image below.
Unfortunately, I cannot figure out at which execution phase the exception is generated, and in particular, the routine that generated it (there is no useful information in the call stack window)
Have you ever had problems like this? How did you solve them?
Thank you very much for your help and collaboration.
Best regards.
Hi @_Ferrari_ ,
I recommend that you add and use a special hardfault handler. I wrote about it here:
https://mcuoneclipse.com/2012/11/24/debugging-hard-faults-on-arm-cortex-m/
You can skip the first part about Processor Expert, and use the extend handler described in the second part of the article. The source code of it can be found here:
https://github.com/ErichStyger/McuOnEclipseLibrary/blob/master/lib/src/McuHardFault.c
That way you should see the PC and LR causing the hard fault.
I hope this helps,
Erich
Hi @_Ferrari_
Can you provide the details of the software you are using? While debugging, what is the code line that is causing the fault?
Best Regards, Miguel.
Hi @_Ferrari_
The fault could be caused, for example, writing into a peripheral register that is not initialized.
Please debugg your code step-by-step with this MCUXpresso tool. Instead of clicking Resume, click step into and tell me where the fault is occured.
Can you tell me what are you coding? We could have a SDK example that can guide you.
Best Regards, Miguel.