Is there an app-note, tutorial, or example of how to use the watchdog timer to reset the MCU if the application hangs?
Is there an app-note, tutorial, or example of how to use the watchdog timer to reset the MCU if the application hangs?
Sorry but this doesnt work, too. I use this steps:
lfclk_config(); CRV = (32768) - 1;
NRF_WDT->RREN = (WDT_RREN_RR0_Enabled INTENSET = 1;
NVIC_EnableIRQ(WDT_IRQn);
NVIC_SetPriority(WDT_IRQn,0);
in the ISR I pull down the enable pin from my 3V LDO to power off the uC.
Ah now it works, the problem was: At the beginning I set the 3V_enable_switch to on. After the WDT reset+pull down the 3V_enable_switch the uC reset very fast and have enough power to reach the row with the 3V_enable_switch command.
Hi Ole,
I tried the code below, but it doesn't work. It does not go to the handler, and it doesn't reset either. I closed the debugger and did a power cycle as required. In the handler, all I do is turn the LED on (LED function works with a button press, for example). I'm not reloading it anywhere yet either. What am I doing wrong?
void watchdog_init(void) { NRF_WDT->CONFIG = (WDT_CONFIG_HALT_Pause << WDT_CONFIG_HALT_Pos) | (WDT_CONFIG_SLEEP_Pause << WDT_CONFIG_SLEEP_Pos);
NRF_WDT->CRV = (32768 * 1); // Timeout period of 1 s
NRF_WDT->RREN |= WDT_RREN_RR0_Msk; //Enable reload register 0
NRF_WDT->INTENSET = WDT_INTENSET_TIMEOUT_Msk;
NVIC_ClearPendingIRQ(WDT_IRQn); NVIC_SetPriority(WDT_IRQn, APP_IRQ_PRIORITY_HIGH); NVIC_EnableIRQ(WDT_IRQn);
NRF_WDT->TASKS_START = 1; // Watchdog start }
Thank you!
Gil
Hi,
If you are using the soft device, you cannot set the priority level as high which is reserved in this case. Try to set it to low priority.
Thank you Sébastien, Unfortunately it still does not work. I tried it with this: NVIC_SetPriority(WDT_IRQn, APP_IRQ_PRIORITY_LOW); Regards, Gil