[ntp:questions] Making ntpd tweak a TCXO

Mark Haun mark at hau.nz
Wed Jan 27 16:55:59 UTC 2016


I have an embedded system (Beaglebone Black) with an external 14.4-MHz TCXO. 
I am going to write a clock-source driver to use this oscillator as the
system clock source in Linux.  The TCXO has a voltage-control input which
can be adjusted with a PWM output from the Beaglebone.

My application (amateur seismometer data acquisition) does not require great
accuracy, but I would like the data stream from my A/D to be long-term
accurate.  That is, if the sampling rate is 60 Hz, I would like 60*86400*365
+/- 1 samples in a [non leap] year.  This should be fairly easy with NTP if
the typical accuracy is in the 10s of milliseconds.  Short-term variations
of a few ppm (the TCXO stability) are no problem.

To that end, I'd like to discipline the TCXO using ntpd.  I would like it to
*not* change the virtual clock frequency in software as it usually does, via
adjtime or whatever hooks are provided by the OS.  Instead, I want the
frequency corrections to go through my own driver to adjust the hardware
oscillator directly.

Does the NTP software provide any hooks that could be used to accomplish
this?  I thought of a crude approach, simply writing a program to examine
the drift file periodically, and using that information to adjust the TCXO. 
But that (a) fails to stop ntpd from adjusting the virtual clock frequency
within the OS, and (b) isn't really a proper control loop.  I guess it would
work, sort of, as a last resort.

Is it feasible to hack the time-adjustment interface on the Linux side of
things, so ntpd doesn't know the difference?  I believe there is an option
to make NTP do frequency corrections only, not time steps.  I would need
that.

Any suggestions?

Thanks,

Mark


More information about the questions mailing list