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

  • 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();
        }     
    }
    
  • thanks for reply, please help me to extern the wdt timer

  • according to project, the process may takes minimum 5 sec to max 20sec. if i have configured wdt upto 20sec, may be my process can be finished within 10sec, i should wait another 10sec to wdt reset. that why i need to extern the timer. i mean, if i configure wdt 1 sec, i can extern to another 1 sec and another 1 sec like that without wdt reset. i can not predict my process of project, when will finish. i could not do manual hard reset. i need to auto reset function. please help me

  • Extern? You mean extend? I'm not sure I understand what you want to do. If you want to change the wdt reset time "online" I guess you could test making #define WATCHDOG_SECONDS into a variable, and then calling wdt_init(); again if you change the variable.. Not sure if it will work though, you can try :-)

  • NRF_WDT->RR[0] = WDT_RR_RR_Reload; what is the use of this code when will reload the value after reset?

Related