[ntp:questions] Making ntpd tweak a TCXO
hmurray at megapathdsl.net
Thu Jan 28 13:00:28 UTC 2016
> 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.
> 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.
I don't think servoing out the drift will do what you want. Suppose your
TCXO slows down a bit. After a while, ntpd notices, tweaks the drift, then
you notice, and adjust it to go the right speed. But during that time, the
clock was running a tiny bit slow so you lost a fraction of a cycle.
I'm assuming your TCXO is driving your A/D.
I think what you want to do is monitor the times when your D/A gives you
data. Suppose you set things up so that each buffer holds 1 second of data.
When the buffer fills, grab the time. Compare that with the expected time.
These are my opinions. I hate spam.
More information about the questions