Question
STM32L4 IWDG freeze in STOP mode
Hello,
I would like to freeze the functionality of the IWDG while the microcontroller is in STOP mode, because I want stop time greater than 32 seconds. I read the documentation and I built the following code:
FLASH_OBProgramInitTypeDef pOBInit;
pOBInit.OptionType = OPTIONBYTE_USER; // Option byte to be configured
pOBInit.USERType = OB_USER_IWDG_STOP; // User option byte(s) to be configured
pOBInit.USERConfig = OB_IWDG_STOP_FREEZE; // Value of the user option byte
HAL_FLASH_OB_Unlock(); // Unlock the FLASH Option Bytes Registers access.
HAL_FLASHEx_OBProgram(&pOBInit); // Program Option bytes.
HAL_FLASH_OB_Launch(); // Launch the option byte loading.
HAL_FLASH_OB_Lock(); // Lock the FLASH Option Bytes Registers access.But I get a HardFault when executing the unlock function.
Could someone help me with this problem?
Best regards,