Creating a high precision RTC with a Teensy 3.2

Status
Not open for further replies.

brivbl

Member
Hello,
Using this type of oscillator (12.8 MHz - Clipped Sine Wave - 0.05ppm):
https://uk.farnell.com/iqd-frequency-products/lfmcxo064082/oscillator-mcxo-12-8mhz-smd/dp/2443045

I'd like to create an accurate RTC using GPS syncronisation as an initialization of the clock. I would use interruptions to detect edges of the oscillator, and count them.

My questions are : - Would the Teensy 3.2 be able to detect edges as this oscillator generates a clipped sine wave signal ?
- Can the Teensy handle such high frequencies as interruption inputs ?

Thanks.
 
Maybe I misunderstood your aim . . ., but if you add a GPS module, you will have a very accurate RTC! You do not need an extremely expensive TCXO then? The Teensy 3.2 already has a builtin RTC, you only need a 32768kHz 12.5pF crystal and solder it to the board.
 
Maybe I misunderstood your aim . . ., but if you add a GPS module, you will have a very accurate RTC! You do not need an extremely expensive TCXO then? The Teensy 3.2 already has a builtin RTC, you only need a 32768kHz 12.5pF crystal and solder it to the board.

As my system won't be able to get time from GPS all the time, it needs to keep an accurate track of time while it goes underwater. I need to process underwater acoustic signals so I also need a really precise RTC
 
Hello,
Using this type of oscillator (12.8 MHz - Clipped Sine Wave - 0.05ppm):
https://uk.farnell.com/iqd-frequency-products/lfmcxo064082/oscillator-mcxo-12-8mhz-smd/dp/2443045

I'd like to create an accurate RTC using GPS syncronisation as an initialization of the clock. I would use interruptions to detect edges of the oscillator, and count them.

My questions are : - Would the Teensy 3.2 be able to detect edges as this oscillator generates a clipped sine wave signal ?
- Can the Teensy handle such high frequencies as interruption inputs ?

Thanks.

Then T3.2 ISR latency for GPIO pin interrupts can only support 1 to 2 MHz.
 
Many of the GPS modules support an extremely precise PPS (Pulse Per Second) signal that can be used to synchronize the Teensy clock.
Many people are using this signal to create a Stratum 1 NTP Time Server.
I know that on Ublox GPS modules, you can set the PPS interval to other than one second in firmware.
 
Does this Time tracking Teensy - that can't use/see GPS - have any other functions to do ?

Wouldn't 12.8 MHz feed a Teensy 4 timer/counter? Does T_3.2 have such a pin function?

Based on T4 Beta thread it seems the T4 could count that? Maybe as Paul noted somewhere add flip flops to drop the count rate?
 
The T3* FTM timers can be fed an external clock, but max frequency is F_BUS/4. So T3.2@120 mhz should work (F_BUS would be 60mhz). FTM timers are only 16-bit so you'd need to handle overflows to get a 32-bit or 48-bit counter.

T3.6 examplehttps://forum.pjrc.com/threads/40825-T3-6-Using-an-external-clock-for-FTM-timers

EDIT: maybe not for T3.2. FTM external input pins are PTA18 and 19 (ALT4), but those are the pins for MCU 16mhz crystal. However the FreqCount lib can count pulses on pin 13 (60+MHz) using LPTMR (or at 132MHz).

PDB can be triggered by external pins (PTC0 or PTC6) https://forum.pjrc.com/threads/24492-Using-the-PDB-on-Teensy-3
 
Last edited:
Many of the GPS modules support an extremely precise PPS (Pulse Per Second) signal that can be used to synchronize the Teensy clock.
Many people are using this signal to create a Stratum 1 NTP Time Server.
I know that on Ublox GPS modules, you can set the PPS interval to other than one second in firmware.

I use the PPS to synchronize my clock, when my system gets back to the surface, it gets GPS signal and synchronizes automatically on PPS rising edge, but then my system is completely autonomous when it goes back underwater so it has to keep an accurate track of time without any network or satellite
 
Does this Time tracking Teensy - that can't use/see GPS - have any other functions to do ?

Wouldn't 12.8 MHz feed a Teensy 4 timer/counter? Does T_3.2 have such a pin function?

Based on T4 Beta thread it seems the T4 could count that? Maybe as Paul noted somewhere add flip flops to drop the count rate?

My teensy is logging info to csv files on an SD card, capturing sounds via an hydrophone and a SGTL5000 to a SD card (wav format)

But if I create a clock, I could do it with a separate teensy and make them communicate via I2C

Flip flops are interesting, I would use TTL D flip flops (sn74175) since they handle higher frequencies
 
How long is the system going to be underwater?
Is the oscillator only counted down to keep track of seconds or are you using it for stamping events with a much higher precision than seconds?

Pete
 
How long is the system going to be underwater?
Is the oscillator only counted down to keep track of seconds or are you using it for stamping events with a much higher precision than seconds?

Pete

The ideal would be several days, then if the precision of the RTC is not sufficient, the system would come back to the surface more often to get a GPS synchronization. The longer it stays undewater, the better.

The oscillator would do both. Keep track of time accurately and stamping my audio recordings with high precision.
 
How I di it, is to ignore the drift of the RTC, and CPU

My files are all 1 minute long (closing driven by RTC seconds)
every header contains the RTC but also millis and micros.
Further I sample regularly (every 100 ms) the temperature of the CPU that I store with RTC, millis and micros (I also sample other non-acoustic data)

GPS is fetched while system is at surface.

with all this stored info it is then possible to reconstruct both the drift in sampling and RTC
This is all you need for underwater (non-realtime) applications

(I planned to use a cesium clock, but they do not like temperature above 30 deg C, so they are not practical)
(others use NTP server that is synced when system is at surface, but week-long underwater system need to be VERY LOW power implementations and all these additional system are power hungry)
 
(I planned to use a cesium clock, but they do not like temperature above 30 deg C, so they are not practical)
I'm curious, there's a cesium clock that's very low power? Also, I would have thought underwater is the one place that a 30 C limit wouldn't be a problem.
 
I'm curious, there's a cesium clock that's very low power? Also, I would have thought underwater is the one place that a 30 C limit wouldn't be a problem.
would not call it very low power, but I could run it from Teensy 3.3V (CSAC SA.45s from Symmetricon http://www.prc68.com/I/pdf/Symmetricom's_SA.45s_CSAC_updates.pdf)
on the 30 C limit: it is not the water but before the system gets into the water (say on board a ship in the summer in the Med)
(BTW, I have seen ocean with more than 30C, close to surface)
 
Status
Not open for further replies.
Back
Top