Showing results for 
Search instead for 
Did you mean: 

STM32L4 : IWDG wake up device in shutdown mode ?


Hi !

I'm using the stm32l452RE mcu and I use the shutdown mode. I also use the watchdog (IWDG) to reset the system if an error occurs. This IWDG is set to 4s. When I go in shutdown mode, accordly to the docs, IWDG should be off because it is clocked with LSI which is off.

Despite this, the device resets exactly after 4s.

If I change IWDG to 10s, device reset after 10s. That's why I'm sure IWDG continues working even when my device goes in shutdown mode.

The only thing I'm not sure is if I really enter in shutdown. Here below is what I do to enter in shutdown mode :

/* Clear flag */

For the IWDG set up, here is what I do :

void MX_IWDG_Init(void)
	hiwdg.Instance = IWDG;
	hiwdg.Init.Prescaler = IWDG_PRESCALER_32;
	hiwdg.Init.Window = IWDG_WINDOW_DISABLE; 
	hiwdg.Init.Reload = (32000 * 4095) / (32 * 1000);
	if (HAL_IWDG_Init(&hiwdg) != HAL_OK)

Have you any idea ?

Thanks for your help !


Okay I got it. To be tested but can a be a good solution to the original post I did.

Note for future readers that you cannot just call a simple macro or clean the register. You have to unlock flash and option bytes register.

For example :