FreeBSD NTP GPS Experiment #5

Using a Garmin GPS-18 LVC unit as a NTP time source

Setup

The server is an eMachines eTower PC, with a Cyrix MII 250 MHz CPU, 164 MB of RAM, 15 GB hard drive, and running FreeBSD 4.9. The computer is attached to a Garmin GPS-18 LVC GPS through a 9-pin DB9F connector, with the Pulse Per Second (PPS) line connected to pin 1 (DCD). A USB cable was also modified to provide +5VDC to the GPS unit (the serial portion of the USB cable was not used). The GPS unit itself is attached via it's internal magnets to a steel plate laid on the building roof. The 5 meter cable runs through an access conduit to the computer.

The GPS-18 LVC was configured using Garmin's snsrcfg.exe program, available at the Garmin website. All NMEA sentences were turned off except GPRMC, which is what ntpd expects by default. The PPS line was enabled, and all other settings were left in default mode.

Software configuration involved enabling the ntp daemon by setting 'xntpd_enable="YES"' in /etc/rc.conf. In /etc/ntp.conf the NMEA and PPS drivers were configured thus:
# NMEA GPS driver
server  127.127.20.0 prefer

# Pulse Per Second (PPS) driver           
server  127.127.22.0
Logging of ntp statistics were also enabled:
# Tell ntpd to keep statistics
statsdir        /var/log/ntp/
filegen clockstats      file clockstats type day        enable
filegen peerstats       file peerstats  type day        enable
filegen loopstats       file loopstats  type day        enable
statistics clockstats peerstats loopstats
# Send log output to a seperate file for NTP
logfile /var/log/ntp/messages

The NMEA and PPS drivers require symbolic links in the /dev directory to repoint them to the actual hardware serial port where the GPS is connected. Links were made as such:
/dev/gps0 -> /dev/ttyd0
/dev/pps0 -> /dev/ttyd0
These point to comm port 1 (COM 1). Note: modern versions of FreeBSD use /dev/cuad0 instead of /dev/ttyd0 for COM 1.

Results:
So far the system has worked quite well, tracking local stratum-2 ntp servers within 100 microseconds. The GPS receiver has not lost lock a single time in the two months it has been running (at this writing), despite occasional temperatures below the specified operating limits.

The system graphs internal NTP statistics once per day, though since the server has only one time source, the stats are more a comparison of the servers internal clock to the GPS, and not the performance of the GPS itself. The performance of the server as compared to other NTP servers can be seen here.

Update: September 2, 2008
The server has been upgraded to a 1.6 GHz Pentium 4 machine with 512 M of RAM, running FreeBSD 6.3. Changes to the timeserver configuration were minimal, the only significant one being the addition of the minpoll and maxpoll statements (set to 4 in each case) to the server entries in /etc/ntp.conf. This has the effect of forcing the server to query the GPS receiver every 16 seconds, as is recommended by some system admins on various NTP discussion lists. The hardware upgrade is overkill but is aimed at keeping the system based on standard, easy to find components.

Update: January, 2009
The GPS unit stopped working in early January. After the physical unit and outdoor cables where checked, the USB power connector was moved to a different port on the computer. This started the receiver running again. It is unknown at this time why the original USB port's power failed. The GPS-18 LVC unit should not draw significant power from the port, and the cables have revealed no worn spots or obvious shorts.

Links:
NTP server using PC gnu/linux and FreeBSD
Adding a FreeBSD NTP server based on an GPS 18 LVC
Using a GPS receiver as a NIST traceable frequency standard
NIST GPS data archive
NIST Time and Frequency Lab
NIST Ion Storage Group