2025-03-18 9:26 PM - last edited on 2025-03-21 1:54 AM by Andrew Neil
STM 32L 051
use HAL_RTCEx_SetWakeUpTimer_IT() to wake up standby mode,it is work well.
when the wake up source is not RTC(maybe wkup pin or NRST pin) ,how get the remaining time of RTC timer?
The value of HAL_RTCEx_GetWakeUpTimer() is not change.it is the value of HAL_RTCEx_SetWakeUpTimer_IT() set.
2025-03-19 12:55 AM
Hello @jinyi7016
Please refer to the article How to use the RTC in STM32 microcontrollers for periodic wake-up and elapsed time calculation.
2025-03-19 6:43 PM - edited 2025-03-19 6:54 PM
thanks reply.
HAL_RTC_GetTime() can get the calendar time to calculate the remaining time.
but I really want to know:
1、
Can function HAL_RTCEx_GetWakeUpTimer() get the remaining time of RTC timer? or only the value HAL_RTCEx_SetWakeUpTimer_IT() set.
2025-03-21 1:53 AM - edited 2025-03-21 1:55 AM
Hello @jinyi7016
The function HAL_RTCEx_GetWakeUpTimer() get just the value of WUTR register previously set with the function HAL_RTCEx_SetWakeUpTimer_IT().
Please refer to for more details the UM174 more details
2025-03-21 8:09 AM
Hi @jinyi7016,
Here is a solution. However, it supposes you are not using the RTC Calendar, only the RTC WUT (Wake-Up Timer).
To better illustrate it, I join the figure below adapted from the reference manual of the STM32L0 series. The idea is the following:
There are two cases:
Let's dive into the details and steps:
Make the RTC_SSR register synchronous with the WUT counter. For this:
Now, to estimate the current value in the WUT counter:
I hope this helps.
With regards,