Hi, I'm having trouble with how to begin debugging a hard fault error in my code. When I run the debugger, it always ends in the HardFault_Handler in arm_startup_nrf51.s after some time. I've looked around at how to debug this, and suggestions to put a breakpoint in the handler and look at the call stack to see how the program ended up there. However, the call stack has nothing but the hard fault handler when the program gets there. Right now, by setting breakpoints throughout my program I've determined that the hard fault is being called in the nrf_delay_us function.
Sometimes, however, the debugger makes it past the nrf_delay_us functions and hard faults in the a memset function called later. Overall, I've been unable to accurately reproduce the hard fault, however it seems to most often be called in these two places.
I am using a nrf51822 chip running the s110 Soft Device using SDK 9.0.0
Any help would be greatly appreciated!