[ntp:questions] How do I validate my PPS clocks?

unruh unruh at invalid.ca
Tue Feb 26 17:16:20 UTC 2013


On 2013-02-26, Charles Elliott <elliott.ch at verizon.net> wrote:
> 	I performed the same kind of test on a commercial real-time O/S at
> the time sold by Intel, but since divested.  I put code in a program to
> output a digital pulse when the mock application program received
> notification of the parallel port interrupt and measured the interrupt
> service delay between generating the interrupt and sensing it with two
> channels of an oscilloscope, which was HIGHLY variable, although I can't
> recall the numbers.
>
> 	You could do the same thing by patching NTPD to output a pulse when

It is not ntpd, it is the interrupt handling routine. This should as the
very first thing it does, even before it knows that this is an interrupt
intended for it, timestamp the interrupt. You would need to put in that
pulse generator at the same time as that timestamping. That interrupt
service routing then goes off and does whatever it is supposed to do
with that time stamp, and that takes a while ( 10usec does not sound
unreasonable). I once had two interrupt service routines handling the
same interrupt, and found that I got something like a 10us difference in
times between them, no matter what order they occured in. Ie, it was
taking one ISR about 10us to handle the interrupt before passing it on
to the next routine. Thus you have to get into the guts of the module
that services the interrupt to place your pulse generator. 

I did it the opposite way. I had an interrupt service routine, and had
another program which read the time, and immediately generated a pulse
on the parallel port. I thenread the interrupt timestamp, the pulse
timestamp and subtracted them to get the time it took to grab the
interrupt. That was what I found to be about 1-2 us. (I used the usual
microsecond accurate clock, not the nanoclock unfortunately at the time,
so the time might have less than a 1us, and I could not see it).

That was under the 2.4 series of kernels, so things might have changed
by now (3.x series) in the way interrupts are handled to slow thing
down. I should rerun the experiment, but do not have time, and besides
almost none of the new computers have parallel ports anymore so putting
out that pulse has become hard. 



> the PPS signal was processed and then measuring the time difference between
> the actual PPS signal and the digital pulse with an oscilloscope.  Compared
> to what I paid for one in the 1990s, oscilloscopes are dirt cheap now.
> There are people who sell them on eBay too.

Agreed. You can get ns resolution storage scoped for a few hundred now.
We use them in our undergrad labs. Mind you some of them do not have a
high lifetime. 



More information about the questions mailing list