Hi,
I am facing hardfault when i try to enable low power in a ble application. i want to enable trace on my PCA10040 board to find out the cause of this hardfault. can you help me to succeed to enable trace ? please.
Best regards.
Hi,
I am facing hardfault when i try to enable low power in a ble application. i want to enable trace on my PCA10040 board to find out the cause of this hardfault. can you help me to succeed to enable trace ? please.
Best regards.
Do you have a J-link trace or similar? Note that the on-board J-link does not support trace.
I have segger J-link Plus www.segger.com/j-link-plus.html
Unfortunately, the j-link plus does not appear to support trace. Does the call stack provide any clues as to what function caused the hardfault? I.e, are there any function calls on the stack prior to the hardfault? You can also get the PC value before the exception occurred by reading the memory at the current stackpointer pluss an offset of 24 bytes (SP+24).
Also you can just insert breakpoints and determine how far the application gets before the exception occurs. With this you should be able to locate the code that triggers it.
EDIT - Attached screen dump for illustration
The function call prior to the exception will generally be shown if it occurred in the application code. Also see that the address of the instruction that caused the hardfault is loaded to R0, but not sure if that is always the case.
To illustrate this I triggered a hardfault exception by accessing an invalid memory area in the battery_level_update function found in the hrs example.
You can download the image to enlarge it.
Thank you for your reply. How can i display call stack? I can't insert breakpoints since the hardfault is random.
i am unable to reproduce the hardfault with debug session !!!