RTC wakeup timeout
RTC wakeup timeout
The RTC.wakeup() method specifies a "timeout" in milliseconds. Is that real time or relative time? For example if you specify a timeout of 60000 do you get an interupt every 60 seconds of real time, i.e., on the minute mark of the RTC? If so, does it keep repeating every minute mark? Thanks.
Re: RTC wakeup timeout
Hi,
I'm not quite sure what you mean by real vs relative time, but the way I think about the RTC is in two parts:
- A low frequency counter that will continue incrementing even in low-power states.
- Some circuitry that knows how to use this to make a calendar. (i.e. it understands seconds/hours/minutes/days/weeks/etc).
`wakeup` is only relevant to the first part. In that sense it's not much different to pyb.Timer except it with different wake-from-sleep behavior (and much lower resolution).
So by specifying a 60000ms interval, you get a callback every minute, but this has no relation to what the current "minute" value is. It doesn't interpret 60000ms as "one minute" and then give you a callback at exactly the minute rollover (and zero seconds) -- it just gives you a callback every 60000ms.
Here's an example out that prints out the current rtc.datetime() every callback:
They're one minute apart, but I wouldn't say they're "on the minute mark".
I'm not quite sure what you mean by real vs relative time, but the way I think about the RTC is in two parts:
- A low frequency counter that will continue incrementing even in low-power states.
- Some circuitry that knows how to use this to make a calendar. (i.e. it understands seconds/hours/minutes/days/weeks/etc).
`wakeup` is only relevant to the first part. In that sense it's not much different to pyb.Timer except it with different wake-from-sleep behavior (and much lower resolution).
So by specifying a 60000ms interval, you get a callback every minute, but this has no relation to what the current "minute" value is. It doesn't interpret 60000ms as "one minute" and then give you a callback at exactly the minute rollover (and zero seconds) -- it just gives you a callback every 60000ms.
Here's an example out that prints out the current rtc.datetime() every callback:
Code: Select all
(2019, 10, 21, 1, 11, 8, 48, 255)
(2019, 10, 21, 1, 11, 9, 48, 255)
(2019, 10, 21, 1, 11, 10, 48, 255)
(2019, 10, 21, 1, 11, 11, 48, 255)
(2019, 10, 21, 1, 11, 12, 48, 255)
Re: RTC wakeup timeout
Thanks for the confirmation. That's what I figured. I need minute marks for my application, and I've coded RTC chips (M41T83Z, DS3234) to do that for another application I have, using assembly to program the chips directly. Looking at the STM reference manual it looks like that should be possible.
Is there anyone out there who has done that?
Thanks
Is there anyone out there who has done that?
Thanks