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

Hard fault

Hi,

I'm working on a project using a custom pcb with a 52832 chip. It has worked good for several months, but I got a Hard Fault during flashing today. Flashed it 3 times before doing a "erase all" in SEGGER. Next time I flashed it, it fails to run because of the hard fault. How do I proceed my troubleshooting to solve this?

Results from debug terminal:

Debug terminal

Thanks,

Arild

  • Hi Arild, 

    I see you have already included the hardfault handling library, which is a good start. The log indicates that the fault occurred at address 0x2a912 (is unaligned) and that this happened while being inside the PendSV_IRQn interrupt.  Have you tried to repeat this to see if it always triggered in this interrupt context (ie last byte of PSR==0xe)? Also, do you have an RTOS that uses the PendSV_IRQn, or is it something else?

    Best regards,

    Vidar

  • I tried again today, but now it says that the fault occurs at 0x2A8E2. Yes, it seems like the last bit of the PSR is always 0xE. The system is running freeRTOS.

    I noticed that some of the prints from nrfx_ppi is cut and it is only printing some of the last characters.

  • In some strange way the system started working again and I dont know why. Disconnected some external pcb's and sensors and  ran a blinky example with no faults. Connected it back up and flashed the original software and it runs like before. Could some bad connections or shortings cause this issue?

  • Hi Steri,

    I took this case, since it seems a bit interesting.

    It seems very strange that you have not changed the code and the app starting failing randomly. And disconnecting some external PCB and sensors made it work. Can you be absolutely sure if it was the external PCB's and sensors that caused it by connecting them back and see if it causes the fault.

    We need to get a direction to debug here and based on the behavior of the app that you mentioned, it seems very confusing.

  • I tried to reproduce the hard fault today, but it works like before now. I am not sure what caused the hard fault problems. The most likely explanation is that some of the wires or connectors were bad and made some weird connection. When I was debugging it seemed like it stopped around the initialization of the IMU which is connected to a I2C bus, but I measured that it was no shorting on the bus while it failed.

Related