Calculate number of RTC ticks MCU spends in STOP2 mode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-11-09 12:00 AM
I want to calculate the actual time the CPU spends in STOP2 mode.
I wake up the MCU either by RTC Alert or LPUART.
The issue is more relevant to LPUART wake use case, because it could happen before the RTC alert expires.
I'm using RTC with LSI which continues to work in low power modes.
Is there a proper way to save the RTC time before and after entering the stop mode?
The RTC is configured to scale from 488 µs to 32s.
So I want the timestamp calculation to support both milliseconds and seconds.
How can I achieve that?
Thanks All!!!
- Labels:
-
Power
-
RTC
-
STM32L4 series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-11-10 6:32 AM
What about using the LP-Timer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-11-10 8:23 AM
Yes I'm using a battery.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-11-10 12:02 PM
Good idea.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-11-18 5:45 AM
This the calculation I'm using:
int duration = (int)((int)rtcStart.SubSeconds-(int)rtcEnd.SubSeconds)*1000;
duration = ((int)rtcEnd.Seconds-(int)rtcStart.Seconds)*1000+duration/(int)rtcEnd.SecondFraction;
looks like it works.

- « Previous
-
- 1
- 2
- Next »