[ntp:questions] Making ntpd tweak a TCXO
mark at hau.nz
Thu Jan 28 17:50:13 UTC 2016
Thanks everyone for the replies.
It was suggested off-list that I hack the Linux adjtime implementation to do
what I want (tweak the TCXO instead of changing the kernel tick increment),
so NTP would work as normal. That may be the simplest solution.
Someone over at time-nuts suggested that the TCXO would be a good candidate
for a "precision hardware clock" driver, part of the Linux PTP
infrastructure. That is designed for the IEEE time-sync standard running
over a network, but the PHC support is designed specifically for
disciplining local clocks from a userspace program. Which is what I need to
do. The TCXO clock would not even need to be used as the Linux system
clock. But I still need to find a way of accurately stamping the ADC
samples in wall-clock time.
A few comments:
Hal Murray [hmurray at megapathdsl.net] wrote:
> 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.
Fair enough... I have been assuming that the frequency deviation is a
zero-mean process, the integral of which will converge to zero over long
periods. That does ignore the initial error.
> I'm assuming your TCXO is driving your A/D.
Yes. It spits out samples at a rate f_osc / 240000 = 60 Hz. My ultimate
task is to timestamp these samples in such a way that there are compressions
and dilations in the time scale, but no discontinuities.
About PWM to trim the TCXO: This is a fairly sophisticated processor
(AM355x) with a lot more complexity than a typical microcontroller. I am
sure that any of the clocks one gets out of the chip, including the PWM
signals, will have troublesome jitter from a time-nut perspective. It seems
unlikely to me, though, that this noise would exceed (or approach) one LSB
of the PWM duty-cycle adjustment. That adjustment gives me 10 or 11 bits
already, which theoretically gets into the single-digits ppb range on the
TCXO. This is vast overkill for a $3 oscillator whose short-term
instability will dwarf such tiny deviations.
More information about the questions