[LinuxPPS] PC Clock Offset

Hal V. Engel hvengel at astound.net
Thu Jun 11 19:49:21 CEST 2009


On Thursday 11 June 2009 09:58:54 am Andrew Hills wrote:
> Hi all,
>
> I'm pretty sure I'm making a newbie mistake here, but it seems that my
> PC clock is, on the order of hundreds of milliseconds, ahead of the GPS
> clock, a Motorola Oncore M12+--usually about 370ms. I've attached the
> quick-and-dirty C program I used to interpret what I read from
> /dev/ttyS0 (note: it's really quick and REALLY dirty; don't trust its
> reliability). Short summary: for every @@Ha message it receives, it
> prints the GPS reported date/time and then the system date/time and the
> difference between the two (in nanoseconds). Playing with the #defines
> will control which portions of the messages are displayed, including a
> very verbose @@Bb interpretation. (I based it entirely on the M12+
> documentation.)
>
> Other information: I'm using NTP's Oncore driver to update the clock. It
> does show continuous reach to GPS_ONCORE in ntpq's peers when the
> antenna is in the right spot.
>
> So, is this offset something done intentionally by NTP, an issue with my
> own program, a natural serial port/communications delay, or something
> else entirely? Even 100ms sounds much too high to me, especially because
> the "DELAY" setting for NTP's Oncore driver is on the order of nanoseconds.
>
> --Andrew Hills

I am not sure why you are seeing this.  A well setup Oncore on a LinuxPPS 
machine should see offsets that approach the microsecond range.  You didn't 
include your /etc/ntp.conf or your /etc/ntp.oncore* files so it is difficult 
for us to tell what you may have done.  Are you using the correct edge of the 
pulse?  If the PPS line is a direct ttl connection from the GPS to the DCD pin 
then you should be using the ASSERT edge but if this is inverted you should be 
using CLEAR.  If you are using the wrong edge then it should be off by about 
200ms.

Also when the serial "time" information arrives from the GPS is not 
deterministic.  What is deterministic is when the PPS pulse arrives.  In other 
words the time data transmitted by the GPS is to number the seconds and is 
always after the top of the second being numbered (actually I think it is 
after the PPS pulse has completed but I may be wrong).  The PPS is to signal 
the exact top of the second (+- sawtooth).  Also keep in mind that the serial 
port hardware may be buffering the data and this adds additional delays.  In 
any case you can NOT use the serial time data for anything other than for 
numbering the seconds since it is not transmitted at the exact top of the 
second and the Motorola specs say that the timing of this data is not 
guarantied and it should not be used for anything other than numbering the 
seconds.

Hal




More information about the LinuxPPS mailing list