diff --git a/src/platform/nrf52/main-nrf52.cpp b/src/platform/nrf52/main-nrf52.cpp index 2ec122062..827863f33 100644 --- a/src/platform/nrf52/main-nrf52.cpp +++ b/src/platform/nrf52/main-nrf52.cpp @@ -5,6 +5,7 @@ #include #include +#define APP_WATCHDOG_SECS 90 #define NRFX_WDT_ENABLED 1 #define NRFX_WDT0_ENABLED 1 #define NRFX_WDT_CONFIG_NO_IRQ 1 @@ -296,15 +297,17 @@ void nrf52Setup() // the first time through the main loop), so that other threads can // allocate their own wdt channel to protect themselves from hangs. nrfx_wdt_config_t wdt0_config = { - .behaviour = NRF_WDT_BEHAVIOUR_RUN_SLEEP, .reload_value = 2000, + .behaviour = NRF_WDT_BEHAVIOUR_PAUSE_SLEEP_HALT, .reload_value = APP_WATCHDOG_SECS * 1000, // Note: Not using wdt interrupts. // .interrupt_priority = NRFX_WDT_DEFAULT_CONFIG_IRQ_PRIORITY }; nrfx_err_t r = nrfx_wdt_init(&nrfx_wdt, &wdt0_config, nullptr // Watchdog event handler, not used, we just reset. ); + assert(r == NRFX_SUCCESS); r = nrfx_wdt_channel_alloc(&nrfx_wdt, &nrfx_wdt_channel_id_nrf52_main); + assert(r == NRFX_SUCCESS); } void cpuDeepSleep(uint32_t msecToWake)