johnlinford
Member
My first post on this forum, thank you for having me here! I've been using Teenys in my projects for several years with great results and they are my go-to SBC for nearly all my designs.
I have a current Teensy 4.1 project that requires accurate time of day (within, say 100ms) and computation of elapsed time between periodic event interrupts to 1ms accuracy. My approach is to discipline the RTC by NTP updates (every 10 minutes) and use one of the Teensy timers running at 1000Hz to provide 1ms intra-second interpolation.
This works very well except if, as can happen, the network goes down and hence no NTP updates. Testing reveals that without NTP updates the RTC drifts about -400ms per day, which is too much for my application. I would prefer not to have to add a DS3231 RTC if I can avoid it, so I'm looking at other ways to maintain accurate real time over, say, a few days.
The built-in timers seem to be pretty accurate over short time scales. I could use my NTP to discipline the 1000Hz timer to maintain real time rather than the RTC but I don't know whether the timer would be any better than the built in RTC over a period of hours or days.
Before I hack into the code perhaps someone can answer these questions:
John
I have a current Teensy 4.1 project that requires accurate time of day (within, say 100ms) and computation of elapsed time between periodic event interrupts to 1ms accuracy. My approach is to discipline the RTC by NTP updates (every 10 minutes) and use one of the Teensy timers running at 1000Hz to provide 1ms intra-second interpolation.
This works very well except if, as can happen, the network goes down and hence no NTP updates. Testing reveals that without NTP updates the RTC drifts about -400ms per day, which is too much for my application. I would prefer not to have to add a DS3231 RTC if I can avoid it, so I'm looking at other ways to maintain accurate real time over, say, a few days.
The built-in timers seem to be pretty accurate over short time scales. I could use my NTP to discipline the 1000Hz timer to maintain real time rather than the RTC but I don't know whether the timer would be any better than the built in RTC over a period of hours or days.
Before I hack into the code perhaps someone can answer these questions:
- What is the clock source for the built-in timers?
- Is its long term accuracy likely to be any better than the RTC?
John