Skip to main content
Explorer II
December 29, 2024
Question

time interval of HAL_RTCEx_WakeUpTimerEventCallback()

  • December 29, 2024
  • 2 replies
  • 556 views

Hello,
Now I'm testing 50msec regular Stop and wakeup using
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 102, RTC_WAKEUPCLOCK_RTCCLK_DIV16);
Firstly I expected HAL_RTCEx_WakeUpTimerEventCallback() is done every 50msec but in real it was far faster than expexted.
How do I calculate time interval of HAL_RTCEx_WakeUpTimerEventCallback()?
And I had onother question.
I checked if systick works normally under the regular Stop and wakeup condition.
So I used serial debug by CDC like following but didn't work.
If WakeUpTimer is applied systick doesn't work normally?
Thanks,

static uint32_t count = 0;
count += 1;
uint8_t send_message[30];
sprintf((char *)send_message, "sec:%d\n", (unsigned int)count);
DebugPrint((char *)send_message);

 

    This topic has been closed for replies.

    2 replies

    Technical Moderator
    December 30, 2024

    Hello @curiae 

    You can use a GPIO PIN which should be set just before entering stop mode and reset in wakeup callback function. The time interval can be after calculated using oscilloscope. 

    ST Employee
    December 30, 2024

    Hello @curiae

    The formula to calculate the wake-up timer interval is:

    SarraS_0-1735554076171.png

    given: 

    • Counter Value = 102
    • Clock Divider = 16
    • RTC Clock Frequency (assuming LSE clock) = 32.768 kHz

    So, yeah it should be around 50 milliseconds trigger, what's the clock source being used? 

    Regarding the Systick behavior, -if I understood correctly- it is important to note that when the MCU enters Stop mode, the SysTick timer is stopped. This is because the SysTick is typically driven by the system clock, which is halted in Stop mode to save power.