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

Watchdog : NRFX_WDT_CONFIG_BEHAVIOUR => Run in SLEEP, Pause in HALT

Hello,

I'm using the watchdog and i'm feeding it in my main loop : 

// Initialize watchdog as soon as possible
err_code = watchdog_init();
APP_ERROR_CHECK(err_code);

// Enter main loop.
for (;;)
{
    if (NRF_LOG_PROCESS() == false)
    {
#ifdef NDEBUG
        // Clear exceptions and PendingIRQ from the FPU unit
        // TODO : find why the following code can trigger an exception in debug
        __set_FPSCR(__get_FPSCR()  & ~(FPU_EXCEPTION_MASK));
        (void) __get_FPSCR();
        NVIC_ClearPendingIRQ(FPU_IRQn);

        // Handle power management
        power_manage();
#endif
    }

    // Feed the watchdog once the CPU has been waken up
    watchdog_feed();
}

/**@brief   Sleep until an event is received. */
void power_manage(void)
{
//#ifdef SOFTDEVICE_PRESENT
    (void) sd_app_evt_wait();
/*#else
    __WFE();
#endif*/
}

I tried with 

#define NRFX_WDT_CONFIG_BEHAVIOUR 1

and 

#define NRFX_WDT_CONFIG_BEHAVIOUR 0

But i'm still having a watchdog that is triggered and i don't knwo why. If someone can help me to debug this. I suspecting to not feeding the watchdog at the right place. The issue only occurs when i'm building and loading a release version (my debug version under Segger Embedded is working)

Best regards,

Aurélien

Related