cancel
Showing results for 
Search instead for 
Did you mean: 

time interval of HAL_RTCEx_WakeUpTimerEventCallback()

curiae
Associate III

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

 

2 REPLIES 2
Saket_Om
ST Employee

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. 

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar
Sarra.S
ST Employee

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. 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.