[time-nuts] Small NTP appliance

Hal Murray hmurray at megapathdsl.net
Fri Nov 6 06:59:42 UTC 2020


> I have one general question. I don't believe that an internal crystal in the
> microcontroller will have the accuracy or precision required to have better
> than a few milliseconds of accuracy (whereas NTP likes to live in the
> microsecond realm), though I very well could be wrong on that one.

Accuracy is not a problem.  You can measure that and correct for it.

Most modern kernels have a side door used by ntpd to adjust the clock 
frequency.  Typical values are few 10s of PPM and it's easy to measure down 
0.001 PPM or better.  The NTP world calls that drift.  If you have a PC or 
Raspberry Pi running Linux or *BSD and ntpd you can find the drift.

The core of the timekeeping ends up with multi-precision arithmetic.  If your 
clock is nominally running at 100 MHz so you would add 10 ns per tick, you 
need a way to patch that 10 to be 9.99999999 or 10.000000001.

The next step is that the crystal frequency isn't constant.  It will change 
with temperature and age.  On the other hand, there is noise on the PPS, so 
you want to average over several/many samples.  You end up with a tradeoff.  
You want to average over many PPS samples but you also want to adjust fast 
enough to track temperature changes.

I would start by just collecting some data.  You want the time stamp when the 
PPS pulse arrives.  If you graph that, it should be a diagonal line.  The 
slope is the "drift".  If you subtract off the long term average drift you 
should see the shorter term wander due to temperature changes and the 
jitter/noise on the PPS.

Grab temperature too if you can.  Best is right at the crystal package.

-- 
These are my opinions.  I hate spam.







More information about the Time-nuts_lists.febo.com mailing list