2020-04-13 06:14 AM
Hello,
Issue :- STM32L4R5 controller will restarting, because of the IWDG in stop1 mode of MCU.
Approach followed : As per reference manual, by clearing the IWDG_STOP bit of FLASH_OPTR register, we can freeze the IWDG counter in stop 1 mode of the MCU.
Below is code used to clear the IWDG_STOP ,
///////////////////////////////////////////////////////////////////////////
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
CLEAR_BIT(FLASH->OPTR, FLASH_OPTR_IWDG_STOP);
HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
//////////////////////////////////////////////////////////////////////////
After clearing the IWDG_STOP bit device will enter in to the stop 1 mode of MCU using below API,
////////////////////////////////////////////////////////////////////////////////////////////
HAL_SuspendTick();
/* Ensure that MSI is wake-up system clock */
__HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_MSI);
/* Enter STOP 1 mode */
HAL_PWREx_EnterSTOP1Mode(PWR_STOPENTRY_WFI);
///////////////////////////////////////////////////////////////////////////////////////////
Please review our approach and provide solution on same.