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

Hardfault - priority levels check out

I'm running into a hardfault. I perform some initialization and enter a main loop. At the end of the main loop, I put the soft device into sleep mode and wait for an interrupt. Upon interrupt, the code loops to the beginning of my main loop and performs an operation based on the interrupt.

I have a small function that I am triggering via a gpiote. This function sets a boolean flag that is checked in my main loop. The gpiote triggers the function when a specific gpio pin goes from low to high. This works.

When the program wakes up, it notices that the boolean flag has been set, it clears it, and proceeds to do some operations. Here's the weird part:

When I only have console operations like uart_put("message").... the code works fine. The moment that I try to perform a I2C read, SPI read, or even when I look at private member variables (looking to see if i'm connected to somebody via BLE), the code triggers a hardfault.

I've double checked all of my interrupts and they are triggering on an priority level 3, app low. I am going to keep working on it but, any help would be greatly appreciated.

NRF SDK 9.0.0 SD S130 enabled

I have tried disabling the Softdevice but, the problem is still persisting. An interesting thing to note is that I have a uart interrupt that wakes up the nrf. When the main loop processes the uart triggered event, I am able to run terminal commands without causing a hardfault.

The following are source files that I am using: Main.cpp sqrlMod.cpp

-thank you

Related