Hi, I'm a beginner in programming Nordic uC and I would like to know how to enable the watchdog in my application. Are there particular functions to call? Thanks!
Hi, I'm a beginner in programming Nordic uC and I would like to know how to enable the watchdog in my application. Are there particular functions to call? Thanks!
Also since it is not a protected service you can write directly to the registers if you want:
void wdt_init(void)
{
NRF_WDT->CONFIG = (WDT_CONFIG_HALT_Pause << WDT_CONFIG_HALT_Pos) | ( WDT_CONFIG_SLEEP_Run << WDT_CONFIG_SLEEP_Pos);
NRF_WDT->CRV = 150*32768; // 150 sec. timout
NRF_WDT->RREN |= WDT_RREN_RR0_Msk; //Enable reload register 0
NRF_WDT->TASKS_START = 1;
}
//And this bit refreshes the WDT. Just put it where ever you think is appropriate.
NRF_WDT->RR[0] = WDT_RR_RR_Reload; //Reload watchdog register 0
Also since it is not a protected service you can write directly to the registers if you want:
void wdt_init(void)
{
NRF_WDT->CONFIG = (WDT_CONFIG_HALT_Pause << WDT_CONFIG_HALT_Pos) | ( WDT_CONFIG_SLEEP_Run << WDT_CONFIG_SLEEP_Pos);
NRF_WDT->CRV = 150*32768; // 150 sec. timout
NRF_WDT->RREN |= WDT_RREN_RR0_Msk; //Enable reload register 0
NRF_WDT->TASKS_START = 1;
}
//And this bit refreshes the WDT. Just put it where ever you think is appropriate.
NRF_WDT->RR[0] = WDT_RR_RR_Reload; //Reload watchdog register 0