2020-07-03
Switched the GPS configuration to one optimized for timing
Based on A Raspberry Pi Stratum 1 NTP Server - Phil's Occasional Blog I switched the gps to a configuration optimized for timing. The default settings are optimized for location services, but I want an NTP server. I used gpsctl to configure the ublox chip in the GPS/RTC Hat:$ gpsctl -a -B 115200 --configure_for_timing -vv Serial port ("/dev/ttyAMA0") open... Serial port open and configured... Automatically determining baud rate... Trying 230400 baud... Trying 115200 baud... Trying 57600 baud... Trying 38400 baud... Trying 19200 baud... Trying 9600 baud... Synchronized on 9600 baud... Changing baud rate to 115200... Successfully changed baud rate to 115200...After that I got location data at a high speed. I changed the /etc/ntp.conf parameters to use the GPS_NMEA and PPS drivers, with:# PPS reference server 127.127.22.0 minpoll 4 maxpoll 4 fudge 127.127.22.0 refid PPS # GPS NMEA driver server 127.127.20.0 mode 89 minpoll 4 maxpoll 4 iburst prefer fudge 127.127.20.0 flag1 0 flag2 0 flag3 0 time2 0.043 refid GPSAnd now I get much better numbers:$ ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== oPPS(0) .PPS. 0 l 14 16 377 0.000 -1.656 0.134 *GPS_NMEA(0) .GPS. 2 l 13 16 377 0.000 -11.730 0.517 +ntpritchie.idef 131.211.8.244 3 u 44 64 377 4.263 1.436 62.373 +metronoom.dmz.c 192.87.106.3 2 u 44 64 377 12.141 -2.250 49.247 koos@henkp:~ $ ntpdc -c kern pll offset: -0.00142676 s pll frequency: 7.468 ppm maximum error: 4.934e-06 s estimated error: 3.372e-06 s status: 2001 pll nano pll time constant: 4 precision: 1e-09 s frequency tolerance: 500 ppmThe time offset factors still need work, but I'm getting close!