cancel
Showing results for 
Search instead for 
Did you mean: 

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

ThorosOfMyr
Associate II

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).

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

9 REPLIES 9

> 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

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.

> RTC, NVIC and EXTI registers look ok.

Post them.

JW

ThorosOfMyr
Associate II

After init

ThorosOfMyr
Associate II

before standby

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

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
Associate

STM32L431CCU6

can you please provide the schematics

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

JW