Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: RTC & time library for Teensy 4.0

  1. #1
    Junior Member
    Join Date
    Jan 2020
    Posts
    12

    RTC & time library for Teensy 4.0

    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

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,588
    T_4.0 has a fully operational RTC Hardware section - and running from vBat power maintains operation when Teensy otherwise Off.

  3. #3
    Junior Member
    Join Date
    Jan 2020
    Posts
    12
    Quote Originally Posted by defragster View Post
    T_4.0 has a fully operational RTC Hardware section - and running from vBat power maintains operation when Teensy otherwise Off.
    Nice !

    Regards
    Philippe

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,302
    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.

  5. #5
    Junior Member
    Join Date
    Jan 2020
    Posts
    12
    Quote Originally Posted by PaulStoffregen View Post
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •