AnsweredAssumed Answered

IWDG (Watchdog) Enable on STM32

Question asked by Damiano Balzani on Feb 2, 2018
Latest reply on Feb 2, 2018 by Damiano Balzani

Hi everybody,

i'm tryng to configure the IWDG but it doesn't work. i didn't find the enable bit, is there?

 

Can you help me?

I post my code here

void wdt_enable(void)
{
RCC -> CSR = RCC -> CSR | 0x00000001; //Enable LSI Clock
while((RCC -> CSR & 0x02)==0)
{
//add timeout code here
}
IWDG -> KR = 0x0000CCCC; //Enable IWDG
IWDG -> KR = 0x00005555; //Enable register access
IWDG -> PR = 0x010; //Set Prescaler /16
IWDG -> RLR = 0xFFF; //Set Reload Value for 2.048 seconds
while(IWDG -> SR) //Check if flags are reset
{
//add timeout code here
}
IWDG -> KR = 0x0000AAAA; //Refresh the counter
}

Thanks in advance

 

Damiano

Outcomes