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

Watchdog not working when in HardFault?

We are configuring the watchdog like this:

// Watchdog
NRF_WDT->CONFIG = (WDT_CONFIG_HALT_Run << WDT_CONFIG_HALT_Pos) | ( WDT_CONFIG_SLEEP_Run << WDT_CONFIG_SLEEP_Pos);
NRF_WDT->CRV = 3*32768;   //ca 3 sek. timout
NRF_WDT->RREN |= WDT_RREN_RR0_Msk;  //Enable reload register 0
NRF_WDT->TASKS_START = 1;

This comes from one of the examples. If I do not reset the watchdog in my code, the processor resets, as intended. However, when a hardfault exception occurs, the watchdog seems to stop working and does not reset the processor, so it is stuck inside the hardfault handler forever.

For now, I have solved this by doing a system reset in the Hardfault handler, but it is a bit scary that the watchdog apparantly does not work while the processor is in an exception status. Is there any reason for this to happen?

Related