See last page for copyright and document info, File: Reeve_GpsNtp-Pi_Setup.doc, Page 21
8. Enable PPS Support in NTP Daemon
The NTP daemon supplied with the Raspbian distribution for the RPi does not natively support PPS so it needs to
be recompiled.
To recompile ntp, first check
http://archive.ntp.org/ntp4/
for the latest production version of NTP. If different
than shown below, modify the strings accordingly. The file will have the general form
ntp-4.2.8px.tar.gz
, where
x is the latest patch number (patch 8 is shown below). Next, run the following commands at the RPi prompt.
Note: These steps may require up to 30 minutes and there will be long periods with no apparent activity on the
SSH terminal:
wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p8.tar.gz
wget
http://archive.ntp.org/ntp4/ntp-4.2.8p8.tar.gz
[old address, do not use]
tar zxvf
ntp-4.2.8p8.tar.gz
cd
ntp-4.2.8p8
/
./configure --enable-linuxcaps
make
(see note below)
sudo make install
Note: For the RPi 2, which has 4 cores, use
make –j5
instead of
make
in the above series of statements.
Copy the recompiled files to their destination (enter the following very carefully to avoid typing mistakes):
sudo service ntp stop
sudo cp /usr/local/bin/ntp* /usr/bin/
sudo cp /usr/local/sbin/ntp* /usr/sbin/
Now, modify the NTP configuration file to use the GPSD and PPS servers:
sudo nano /etc/ntp.conf
Add the following lines in the configuration file to specify the GPSD shared memory and kernel-mode PPS
drivers. They can be placed above the server pool list (see screenshot below). The time1 parameter in the
shared memory driver (127.127.28.0) probably will require adjustment but that will be covered later.
# Coarse time ref-clock using shared memory GPS serial data
server 127.127.28.0 minpoll 4 maxpoll 4 prefer
fudge 127.127.28.0 flag1 1 time1 +0.500 refid GPSD
# Precise time ref-clock using Kernel-mode PPS from GPS
server 127.127.22.0 minpoll 4 maxpoll 4
fudge 127.127.22.0 refid KPPS
Note the flag1 setting in the shared memory driver for GPSD; this setting is for standalone operation in which
initial time is established by the GPS serial data. If true standalone operation (no access to any other time
server), these lines should be entered as shown above. However, if the RPi time server will have access to
external servers, the flag1 1 setting can be deleted. Additional information on the fudge factors for the shared
memory and PPS drivers is given at the end of this section. Additional information on the various reference clock
drivers is at {
NTPRefClk
}.