AnsweredAssumed Answered

unwanted stop mode wakeup (STM32L052K8)

Question asked by Michal Dubovsky on Jun 9, 2017
Latest reply on Jun 13, 2017 by Zhitai Liu

Hello, I am running into a problem while trying to put MCU into a STOP mode. I have tried to comment out all of the "unnecessary" code but It does not work even if I leave just this in the source:

HAL_Init();

SystemClock_Config();

MX_GPIO_Init();

while(1)

{

__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); // clear WU FLAG
HAL_PWREx_EnableUltraLowPower(); // Enable Ultra low power mode
HAL_PWREx_EnableFastWakeUp(); // Enable the fast wake up from Ultra low power mode
// Select HSI as system clock source after Wake Up from Stop mode
__HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_HSI);
// go to sleep with low power regulator ON
// WFI = the device is woken up by any pending interrupt
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

blink_led();

}

It seems as if the processor never even entered the sleep mode (or woke up immediately after entering it) because the LED just keeps blinking. This happens even if I disable all interrupt sources using HAL_NVIC_DisableIRQ();

Outcomes