This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to save the hard fault offline?

Hello:
        I have a question about log Hard fault offline. Now i am using nRF52840 in my product. When the system to wrong, i want to save the error for analyse, my question is:
1.Is there some method for me to save the nrf_log module information in the nor flash or onchip flash?
2.Or I will use the nor flash to save the information, but when the code go into the HardFault_Handler, the interrupt is forbidden so the spi interrupt cann't work, is there any other mothod?
3. I found that in the HardFault_Handler function, the gpio can be controlled. So can i use the gpio to simulate the spi without interrupt, to save the data?

  • If you've had a Hard Fault, then you must assume that your system is in an unstable state - so you want to do as little as possible!!

    Probably the best thing is to have an area of RAM that is not cleared on startup, and save your debug information there, then restart.

    When your system restarts, check for debug info - and save it to somewhere more permanent if required.

  • Tks,i will check the method。