Trying to put STM32L471RG into Shutdown mode
I am trying to put the STM32L471RG into Shutdown mode.
I am doing the following steps, based on the documentation.
// Turn on Deepsleep bit
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk; // Setup Low Power Mode State and Shutdown PWR->CR1 |= 0x4004; // Set LPR and LPMS_SHUTDOWN bits // Clear WUFx bits PWR->SR1 &= ~PWR_SR1_WUF; // Go to sleep __WFE();I believe this should put the MCU in shutdown mode. I have a watchdog running also. In the shutdown mode the watchdog should get turned off, and it should not be able to reset it. But the MCU is getting reset. I checked by turning on the freeze watchdog counter option bit for STOP mode, this did stop the reset from happening. This would imply the MCU has actually gone into one of the two STOP modes.
What am I doing wrong?
#low-power #stm32l4 #shutdown