Configure NTPd with PPS. Based on Raspbian Stretch.
Notes:
noselect
to get GPSd to start.Sources:
Based on Raspbian Stretch
echo "dtoverlay=pi3-disable-bt" >> /boot/config.txt
sudo systemctl disable hciuart
systemctl mask serial-getty@serial0.service
console=serial0,115200
from /boot/cmdline.txt
cat /dev/serial0
apt install pps-tools setserial
echo "dtoverlay=pps-gpio,gpiopin=18" >> /boot/config.txt
/etc/udev/rules.d/gps.rules
KERNEL=="ttyAMA0", RUN+="/bin/setserial /dev/ttyAMA0 low_latency" KERNEL=="ttyAMA0", SYMLINK+="gps0" KERNEL=="pps0", GROUP="dialout", MODE="0660"
/dev/pps0
device# ppstest /dev/pps0 trying PPS source "/dev/pps0" found PPS source "/dev/pps0" ok, found 1 source(s), now start fetching data... source 0 - assert 1552847111.000139273, sequence: 152 - clear 0.000000000, sequence: 0 source 0 - assert 1552847112.000135096, sequence: 153 - clear 0.000000000, sequence: 0 source 0 - assert 1552847113.000135337, sequence: 154 - clear 0.000000000, sequence: 0 source 0 - assert 1552847114.000134886, sequence: 155 - clear 0.000000000, sequence: 0 source 0 - assert 1552847115.000135615, sequence: 156 - clear 0.000000000, sequence: 0 source 0 - assert 1552847116.000137416, sequence: 157 - clear 0.000000000, sequence: 0
apt install gpsd gpsd-clients
/etc/default/gpsd
DEVICES="/dev/ttyAMA0" GPSD_OPTIONS="-n"
cgps
or gpsmon
.systemctl stop systemd-timesyncd systemctl disable systemd-timesyncd
sudo apt install libcap-dev
# Download latest from http://www.ntp.org/downloads.html curl -OL http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p13.tar.gz tar zxvf ntp-4.2.8p13.tar.gz cd ntp-4.2.8p13 ./configure --enable-linuxcaps make -j4 sudo make install sudo cp /home/user/ntp-4.2.8p13/scripts/rc/ntpd /etc/init.d/ # Modify ntpd location in /etc/init.d/ntpd, and add lines below above variables. ### BEGIN INIT INFO # Provides: ntpd # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: NTPD ### END INIT INFO groupadd ntp useradd -d /var/lib/ntp -g ntp -s /bin/false ntp printf 'PATH=${PATH}:/usr/local/bin\n' > /etc/profile.d/ntp-path.sh install -v -o ntp -g ntp -d /var/lib/ntp systemctl enable ntpd
/etc/ntp.conf
# PPS server 127.127.22.0 minpoll 4 maxpoll 4 true fudge 127.127.22.0 flag3 1 refid PPS # GPS Serial, GPSD SHM server 127.127.28.0 minpoll 4 maxpoll 4 iburst prefer fudge 127.127.28.0 flag1 1 time1 0.200 refid SHM0 stratum 1 # PPS, GPSD SHM server 127.127.28.2 minpoll 4 maxpoll 4 fudge 127.127.28.2 flag1 1 refid SHM2 # GPSD JSON driver, to auto start GPSD server 127.127.46.0 minpoll 4 maxpoll 4 noselect # Fix False tickers tos mindist 0.5
systemctl enable ntp systemctl start ntp
/etc/dhcpcd.conf
#option ntp_servers