AnsweredAssumed Answered

IWDT refresh and reset

Question asked by sd.pranathi on Mar 27, 2013
Latest reply on Apr 3, 2013 by fm
Hello All,

I am using stm32f2 series. I have initilized Independent watch dog timer.
My intention is , when there is some probelm in the peripherals, i need to reset the device (microcontroller) after few seconds.
So my question is Refreshing a watchdog timer will do this or not?

Here is my initialization code

 
void WatchDogInit(void)
{
 /*Clear all Reset Flags */
   RCC_ClearFlag();
 /*Enable write access to IWDG_PR and IWDG_RLR registers*/
  IWDG->KR = IWDG_WRITACCESS_ENABLE;
  /*IWDG counter clock using  pre scalar 8 - LSI/8*/
  IWDG->PR = IWDG_PR_PR_0; /*Bit 0 in PR register*/
   /*Set counter reload value to obtain 1 sec IWDG TimeOut.*/
  IWDG->RLR = IWDT_RELOAD_VALUE;
  /*Reloads IWDG counter with value defined in the reload register*/
  IWDG->KR = KR_KEY_RELOAD;
  
  
}

I am not sure whether the below code make sense



void WatchDogRefresh(void)
{
 /*Writing 0xAAAA in the Key register prevents watchdog reset*/
 IWDG->KR = KR_KEY_RELOAD;
}


Coula anyone pls let me know how to implement this


Thanks

Outcomes