Skip to main content
ThorosOfMyr
Associate II
May 19, 2022
Solved

Why doesn't the uC STM32L431CCT6 exit standby mode with RTC wakeup event?

  • May 19, 2022
  • 7 replies
  • 3363 views

I have a STM32L431CCT6 uC configured with CubeMX (project attached): RTC connected to LSE 32.768 kHz, auto wake up enabled. In my code, I perform the following calls:

HAL_GPIO_WritePin(LED2_RESET_ESP32_GPIO_Port, LED2_RESET_ESP32_Pin, GPIO_PinState::GPIO_PIN_RESET);
HAL_PWREx_EnableInternalWakeUpLine();
result = HAL_RTCEx_SetWakeUpTimer(&hrtc, 0x0000FFFF, RTC_WAKEUPCLOCK_RTCCLK_DIV2);
if(result == HAL_OK)
{
 HAL_PWR_EnterSTANDBYMode();
}

The uC enters correctly the standby mode, it should wake up after 4 seconds, ma it never does. I tried to check if wake up interrupt is launched, removing the HAL_PWR_EnterSTANDBYMode() call, but handler code is never executed (no breakpoint hit, no led blinked).

This topic has been closed for replies.
Best answer by ThorosOfMyr

That was the problem, the WUTIE bit were not set, because HAL_RTCEx_SetWakeUpTimer just set up the timer but not the interrupt. If you need to set also the interrupt, HAL_RTCEx_SetWakeUpTimer_IT must be used.

7 replies

waclawek.jan
Super User
May 19, 2022

> handler code is never executed

Then it's not standby-mode related, is it?

Read out and check/post content of RTC, EXTI, NVIC, and any other registers which may be related to wakeup.

JW

ThorosOfMyr
Associate II
May 19, 2022

Yes, it looks like it's about the RTC wake up event. Accordingly also to AN4759, chapter 2.4, I can't find if there is anything wrong in my configuration.

RTC, NVIC and EXTI registers look ok.

waclawek.jan
Super User
May 19, 2022

> RTC, NVIC and EXTI registers look ok.

Post them.

JW

ThorosOfMyr
Associate II
May 19, 2022
ThorosOfMyr
Associate II
May 19, 2022
waclawek.jan
Super User
May 19, 2022

Why are EXTI and RTC registers content not visible in the "before standby" file?

In the other file, RTC_CR is 0x403, i.e. WUTE is enabled but WUTIE is not. Quoting from RM:

> When the periodic wakeup interrupt is enabled by setting the WUTIE bit in the RTC_CR

> register, it can exit the device from low-power modes.

JW

ThorosOfMyr
ThorosOfMyrAuthorAnswer
Associate II
May 19, 2022

That was the problem, the WUTIE bit were not set, because HAL_RTCEx_SetWakeUpTimer just set up the timer but not the interrupt. If you need to set also the interrupt, HAL_RTCEx_SetWakeUpTimer_IT must be used.

Tkumar.2
Visitor II
June 8, 2022

STM32L431CCU6

can you please provide the schematics

waclawek.jan
Super User
June 8, 2022

Please start a new thread and post clearly your question there.

JW