Subject: Re: timekeeping and GPS receivers
To: None <netbsd-help@netbsd.org>
From: Danny Thomas <D.Thomas@imb.uq.edu.au>
List: netbsd-help
Date: 12/03/2000 12:14:02
Brook Milligan <brook@biology.nmsu.edu> asked
>I recall that there was some documentation on hooking up a GPS
>receiver with a PPS output and configuring NetBSD as a time server.  I
>can't find those docs anywhere, though, so perhaps I'm dreaming.
>
>Anyway, can anyone point me to any docs that describe how to configure
>the kernel (other than the NTP/PPS_SYNC options), /dev, /etc/ntp.conf,
>xntpd, and anything else needed to use NetBSD as a time server?

unfortunately I spent too much time on writing up about GPS for a local
SAGE talk
  http://www2.imb.uq.edu.au/Computing/Tech/GPS_NTP_Setup.html
  http://www2.imb.uq.edu.au/Computing/Tech/NTP_GPS_Setup.html

the ntp info is not good enough, hence the following

0) ntpd (ntp4) is preferred to xntpd (ntp3)
   NB the ntp protocol is not yet defined for IPv6
1) connect your GPS receiver to a serial port
2) I used minicom from pkgsrc (@4800 baud) to ensure the
   NMEA data is working - you'll see sentences output every second
   make sure the receiver is locking onto satellites. Like these
$GPGSA,A,3,,06,10,,17,23,26,30,,,,,2.1,1.7,1.3*32
  the '3' means it's a 3D fix. In this case it's receiving signals from
  satellites 6,10,17,23,26,30
$GPGSV,2,1,08,05,14,006,,06,74,155,34,10,22,140,31,15,07,271,*76
$GPGSV,2,2,08,17,49,228,35,23,40,325,37,26,31,069,35,30,38,340,34*76
  these two sentences list the satellites in view, there a four numbers
  for each satellite likely to be in view, the satellite number, elevation
  azimuth, strength(dB). So satellite 5 is not being seen (',,' means
  no signal) which is why it's not listed in previous sentence - there
  was a gap ',,'. Satellite 6 is at strength 34, 10 at strength 31,
  15 not seen, 17 at 35, 23 at 37, 26 at 35, 30 at 34
$GPRMC,011333,A,2729.9815,S,15300.7415,E,000.0,208.5,031200,011.3,E*6F
  it's 01:13:33UTC, my antenna at 27deg 29.9815S 153deg 0.7415S

   NB you don't have to follow the NMEA driver instructions by
   disabling unwanted sentences - the driver ignores the ones it is
   not looking for
   In my case, partly because of weak signals it can take 20+ minutes to
   get a 3D fix and start outputting the PPS
3) I used the generic NMEA driver in ntpd (driver 20) so in ntp.conf add
     # must use 'prefer' to lock this one down (prevent clockhopping)
     server 127.127.20.0  prefer
   You'll also want to list some other ntp servers and probably
   have some ACL rules too.
4) ln /dev/gps0 to /dev/com1
5) even without the PPS working ntpd should work (poorly) from this
   serial signal - it'll drift by a few hundred milliseconds before it
   decides it's too unreliable (dunno why the drift is so high)
6) connect PPS signal to serial DCD

I aren't logging it, but generally ntpd thinks the gps is within around 20
microseconds of real time - sometimes it will drift much worse than this.
It could be because I'm getting a weak signal from a too-long antenna
cable, but then other NetBSD folk suspect has some kernel problems causing
this (related to long but variable periods before the PPS interrupt
serviced)


cheers,
Danny Thomas