2023-09-07 3:45 AM
I'm using a WB55 with IWDG enabled.
I want to disable The IWDG when the device is in Standby mode.
I have cleared the IWDGSTDBY bit using STM32CubeProgrammer, but I still get resets from the IWDG.
What am I doing wrong?
Solved! Go to Solution.
2025-04-14 8:32 PM - edited 2025-04-14 11:44 PM
2025-04-15 1108
中文:
感谢 ASimo.3 ,我尝试了你的代码,在 STM32U575RI56 上工作正常 !
实际上,我想用的是 Shutdown 模式,但是发现 IWDG 在低功耗期间仍然工作,通过查看参考手册,我怀疑进入的是 Standby 模式,所以需要办法来 “冻结” IWDG。我检查了进入 Shutdown 的各项条件,都正常,不明白为什么还会进入 Standby,如果有人知道原因,请及时联系我,谢谢!
English:
Thank ASimo.3! I tried your code, and it works properly on STM32U575RI56!
Actually, what I intended to use was the Shutdown mode. However, I found that the IWDG (Independent Watchdog) still operates during low-power consumption. After checking the reference manual, I suspected that the device entered Standby mode instead. Therefore, I need a way to "freeze" the IWDG. I have checked all the conditions for entering Shutdown mode, and they are all normal. I don't understand why it still enters Standby mode. If anyone knows the reason, please contact me. Thank you!
I add one condition and some log:
HAL_StatusTypeDef power_iwdg_frozen(void)
{
FLASH_OBProgramInitTypeDef OB;
HAL_FLASHEx_OBGetConfig(&OB); // get current config
if((OB.USERConfig & FLASH_OPTR_IWDG_STDBY) ||
(OB.USERConfig & FLASH_OPTR_IWDG_STOP))
{
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
OB.OptionType = OPTIONBYTE_USER;
OB.USERType = (OB_USER_IWDG_STOP | OB_USER_IWDG_STDBY);
OB.USERConfig = (OB_IWDG_STOP_FREEZE | OB_IWDG_STDBY_FREEZE);
if(HAL_FLASHEx_OBProgram(&OB) != HAL_OK)
{
HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
log_warning("HAL_FLASHEx_OBProgram failed\r\n");
return HAL_ERROR;
}
HAL_FLASH_OB_Launch(); // REBOOTS THE MCU
/* We should not make it past the Launch, so lock
* flash memory and return an error from function
*/
HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
log_warning("HAL_FLASH_OB_Launch failed\r\n");
return HAL_ERROR;
}
log_debug("IWDG Frozen in Standby & Stop\r\n");
return HAL_OK;
}