Skip to main content
paul0208
Associate III
October 8, 2019
Question

IWDG is not working

  • October 8, 2019
  • 4 replies
  • 934 views

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

This topic has been closed for replies.

4 replies

TDK
October 8, 2019

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
paul0208Author
Associate III
October 8, 2019

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
October 8, 2019
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
October 8, 2019

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""."