3
votes

I using an STM32 (L0 5) HAL I need to disable IWDG or WWDG before entering in STOP mode. The below code is working fine until IWDG is resetting the MCU from STOP mode. For WWDG usage this is much faster and reset before HAL_PWR_EnterSTOPMode is called, despite HAL_WWDG_Refresh is called after each line. I tested also those scenarios also on Nucleo L05.

iwdgHandle.Instance = IWDG;
iwdgHandle.Init.Prescaler = IWDG_PRESCALER_64;
iwdgHandle.Init.Window = 4095;
iwdgHandle.Init.Reload = 4095;
if (HAL_IWDG_Init(&iwdgHandle) != HAL_OK) // almost 7secs until refresh has to be called
{
 _Error_Handler(__FILE__, __LINE__);
}

HAL_PWR_EnableWakeUpPin(WakeSpi_Pin);
HAL_PWREx_EnableUltraLowPower(); // Enable Ultra low power mode
HAL_PWREx_EnableFastWakeUp(); // Enable the fast wake up from Ultra low power mode

HAL_SuspendTick();
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
1
In the meanwhile I found the following: : ''the IWDG is started by writing to its Key register or by hardware option. Once started it cannot be stopped except by a Reset.''Colateral
also from ST: One of the differences between WWDG and IWDG is that IWDG has independent clock. The WWDG is clocked from APB bus whose frequency is derived from the core clock (SYSCLK). Due to the fact that the core clock is stopped in STOP mode the WWDG clock is stopped as well. This means it is automatically stopped in STOP low-power mode and you don't have to refresh it. With IWDG you would have to wake-up regularly and refresh it. Microcontrollers from STM32L4 family allow to stop also IWDG in STOP mode (by setting corresponding option byte).Colateral

1 Answers

4
votes

The Independent watchdog can not be stopped in any processor mode. You have to wake up regularly to reload the watchdog. What you can do is change the prescaler to maximum so the watchdog is counting slowly.

IWDG will only be stopped if you disconnect the controller from the power supply.