2026-03-31 12:39 AM
hello,
I encountered a problem while developing for stm32u585.
I change the iwdg reload value by HAL_IWDG_Init(), and then HAL_PWR_EnterSTANDBYMode(), but the new reload value does not take effect:
hiwdg.Instance = IWDG;
hiwdg.Init.Prescaler = IWDG_PRESCALER_64;
hiwdg.Init.Window = 4095;
hiwdg.Init.Reload = 3600;
hiwdg.Init.EWI = 0;
HAL_IWDG_Init(&hiwdg);
HAL_IWDG_Refresh(&hiwdg);
HAL_Delay(300); //more than one downcount
HAL_PWR_EnterSTANDBYMode();if delay before refresh, it seems work
hiwdg.Instance = IWDG;
hiwdg.Init.Prescaler = IWDG_PRESCALER_64;
hiwdg.Init.Window = 4095;
hiwdg.Init.Reload = 3600;
hiwdg.Init.EWI = 0;
HAL_IWDG_Init(&hiwdg);
HAL_Delay(300); //more than one downcount
HAL_IWDG_Refresh(&hiwdg);
HAL_PWR_EnterSTANDBYMode();Is this the correct process ? If I want to ensure the modification is successful, what should I pay attention to
Solved! Go to Solution.
2026-03-31 7:20 AM
Hello @lll
after changing the IWDG prescaler/reload, the new configuration is not guaranteed to be fully effective if you enter STANDBY immediately. Even though HAL_IWDG_Init() waits for update flags, the IWDG (running on LSI in another clock domain) needs a short time to synchronize internally. Therefore, your second sequence is the correct approach: add a small delay after HAL_IWDG_Init() and before the first HAL_IWDG_Refresh() / HAL_PWR_EnterSTANDBYMode(), to ensure the new reload value is properly taken into account.
2026-03-31 7:20 AM
Hello @lll
after changing the IWDG prescaler/reload, the new configuration is not guaranteed to be fully effective if you enter STANDBY immediately. Even though HAL_IWDG_Init() waits for update flags, the IWDG (running on LSI in another clock domain) needs a short time to synchronize internally. Therefore, your second sequence is the correct approach: add a small delay after HAL_IWDG_Init() and before the first HAL_IWDG_Refresh() / HAL_PWR_EnterSTANDBYMode(), to ensure the new reload value is properly taken into account.
2026-03-31 8:05 AM
LSI=32K, prescaler=128 ==> IWDG=250Hz
before: prescaler=64, reload=40
after: prescaler=512, reload=3600
if i only config once, i need to delay about 3s. if i config twice, it seems that only a delay of 300ms is needed:
hiwdg.Instance = IWDG;
hiwdg.Init.Prescaler = IWDG_PRESCALER_64;
hiwdg.Init.Window = 4095;
hiwdg.Init.Reload = 3600;
hiwdg.Init.EWI = 0;
HAL_IWDG_Init(&hiwdg);
HAL_Delay(350);
HAL_IWDG_Refresh(&hiwdg);
hiwdg.Instance = IWDG;
hiwdg.Init.Prescaler = IWDG_PRESCALER_512;
hiwdg.Init.Window = 4095;
hiwdg.Init.Reload = 3600;
hiwdg.Init.EWI = 0;
HAL_IWDG_Init(&hiwdg);is this sequence correct?