cancel
Showing results for 
Search instead for 
Did you mean: 

IWDG is not working

paul0208
Associate III

Hi,

In stm32f051, iwdg is not working, I think.

After enable iwdg, encounter the while(1); loop , reset is not issued.

NRST pin is connected to RC reset circuit.

BR

Paul

4 REPLIES 4
TDK
Guru

It works. You either didn't enable it or have incorrect settings. But since you posted no code and no info apart from that you enabled it, we can only guess at what the problem is.

If you feel a post has answered your question, please click "Accept as Solution".
paul0208
Associate III

My iwdg enable code is as follow:​

void

WatchDog_Config (void)

{

 /* Enable write access to IWDG_PR and IWDG_RLR registers */

 IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);

 /* IWDG counter clock */

 IWDG_SetPrescaler(IWDG_Prescaler_32);

 IWDG_SetReload(96000000L/32);

 /* Reload IWDG counter */

 IWDG_ReloadCounter();

 /* Enable IWDG (the LSI oscillator will be enabled by hardware) */

 IWDG_Enable();

DBG ("IWDG Started\n");

}

BR

Paul

TDK
Guru
IWDG_SetReload(96000000L/32);

The RLR register is 12 bits.

If you feel a post has answered your question, please click "Accept as Solution".
TDK
Guru

And even if the value wasn't out of range, your IWDG would take 40 hours to trigger a reset.

96000000/32*32/40kHz = 40 hours

If you feel a post has answered your question, please click "Accept as Solution".