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

Hardfault when running NRF52832 without a debugger

I have developed an application for the NRF52832, initially with the Keil toolset and changed to Eclipse/GCC. The application works great when I build/load with the Keil toolset but I developed a problem after switching to Eclipse/GCC. The application runs fine within Eclipse via JLINK but if the target is powered up without being connected to the debugger it will halt or crash.

  • Attach target to JLINK, start the debugger, run app. Everything is fine.
  • Disconnect the target to JLINK and power it up, it fails to start.
  • Reconnect the target to JLINK, start Eclipse Debug with "Connect to running target" enabled, it shows that the CPU is in the HardFault_Handler.
  • Restart the CPU from the debugger, it runs just fine again.

I've traced it a bit using my LED indicators and it seems to run through SystemInit() without any problems but it goes into Hardfault (I think) when jumping to main().

I'm using Eclipse Mars, GNU ARM C/C++ tools and SDK NRF5 v11.

Any suggestions or questions are welcome.

Related