RTC & time library for Teensy 4.0

Status
Not open for further replies.

PhilippeA

Member
Hello,


With current library and board support package, I am wondering if the Time library with Teensy 4.0 uses the RTC hardware or an emulation using timers: Especially for now() and setTime(t) ?


Regards

Philippe
 
T_4.0 has a fully operational RTC Hardware section - and running from vBat power maintains operation when Teensy otherwise Off.
 
The Time library always uses the Arduino millisecond timer stuff and is meant to sync to an "external" source. To the Time lib, the RTC is considered external, which can be a little confusing since it's built into the chip. If you keep in mind the Time lib was originally designed for syncing to a variety of sources like GPS or internet NTP (network time protocol), then it usually makes good sense.

Just remember, the Time library syncs to the RTC, rather than accessing it directly.

And of course you need to add a 3V coin cell to VBAT if you want the RTC to keep the date/time while main power is off.
 
The Time library always uses the Arduino millisecond timer stuff and is meant to sync to an "external" source. To the Time lib, the RTC is considered external, which can be a little confusing since it's built into the chip. If you keep in mind the Time lib was originally designed for syncing to a variety of sources like GPS or internet NTP (network time protocol), then it usually makes good sense.

Just remember, the Time library syncs to the RTC, rather than accessing it directly.

And of course you need to add a 3V coin cell to VBAT if you want the RTC to keep the date/time while main power is off.

Ok, it is what i had in mind. What is unclear for me is how you address the internal RTC.
is there a library ?

Regards
Philippe
 
Status
Not open for further replies.
Back
Top