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

Reconfigure of WDT

hi,

i need to reconfigure the WDT and also change the timer value in WDT. is it possible to do that.

i tried but i can not.

1.configured wdt with timer 5sec. 2.i had reconfigued wdt with timer 1 sec.

before reconfigue i have clear the start task(START_TASK=0)

but it still running upto 5 sec

please any one help

Parents
  • This works for me (SDK 14.0.0 with s132) ..

    In main.c:

    #define WATCHDOG_SECONDS 5 /**< Time in [seconds] before watchdog resets MCU. */
    
    /**@brief Function for initializing the watchdog.
     *
     * @details This function will be called in case of the watchdog timer not being reset at the end of the big while
     *
     * @warning This may or may not cause resets on errors when initialized
     */
    void wdt_init(void){
        //Configure Watchdog. a) Pause watchdog while the CPU is halted by the debugger.  b) Keep the watchdog running while the CPU is sleeping.
    	NRF_WDT->CONFIG = (WDT_CONFIG_HALT_Pause << WDT_CONFIG_HALT_Pos) | ( WDT_CONFIG_SLEEP_Run << WDT_CONFIG_SLEEP_Pos);   
    	NRF_WDT->CRV = WATCHDOG_SECONDS*32768;  // timout limit
    	NRF_WDT->RREN |= WDT_RREN_RR0_Msk;      // Enable reload register 0
    	NRF_WDT->TASKS_START = 1;               // Start the Watchdog timer
    }
    
    int main(void){
        
        wdt_init();     //Initialize watchdog
    
        for(;;){
            // Application stuff
             NRF_WDT->RR[0] = WDT_RR_RR_Reload;  //Reload watchdog register 0
             power_manage();
        }     
    }
    
  • The watchdog must be configured before it is started. After it is started, the watchdog’s configuration registers, which comprise registers CRV, RREN, and CONFIG, will be blocked for further configuration.

    If you need to reconfigure WDT after it's started, you should instead look into using the RTC.

Reply Children
No Data
Related