About RTC in sleep mode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-08-09 2:43 AM
We are developing a device that periodically boots in Sleep mode using the STM32G04.
Set the WakeUpTime with HAL_RTCEx_SetWakeUpTimer_IT and enter Sleep with HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);.
If you make a program to Sleep for 10 minutes, the RTC time is the same before and after startup and the RTC is not counting during Sleep.
The time in Sleep is set to 10 minutes, but even if I do HAL_RTC_GetTime, the value is the same before Sleep and after Sleep.
Is it possible to make it so that the RTC is updated during Sleep?
- Labels:
-
RTC
-
STM32G0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-08-09 3:01 AM
Hello J_m,
First of all I can see that you are entering stop mode rather than sleep mode with HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
In this case I would like to know how you clocked your RTC please?
Regards,
Stassen
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-08-09 5:20 PM
Hello Stassen
I would like to use the STOP mode.
I want to see how much time has passed before entering STOP mode and after wake up.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-08-10 1:46 AM
Hello J_m,
In this case i suggest you:
- clock your RTC with the LSE
- Before going into stop mode, read the RTC counter value
- Enter STOP mode
- Upon wakeup you read the RTC counter value
Note that in stop mode all clocks are switched off except the LSE/LSI.
Hope this helps.
Regards,
Stassen
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-08-10 2:23 AM
Hello Stassen
Thanks.
Is the following code sufficient to set up the RTC to run on LSE?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-08-10 5:16 AM
J_m,
That should do it, just check that in the HAL_RTC_MspInit the clock selection is also LSE.
Regards,
Stassen
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-08-14 12:24 AM
Thank you very much.
I can confirm that the RTC is updated.
