Understanding RPi GPSD PPS SHM units


Please excuse my probably newbie question …

I have a Pi running GPSD and I see the input from the AdaFruit Ultimate GPS, and I see the PPS input as well (ppstest). I have NTP running, and I’m using the SHM driver.

I found an article that talks about the SHM driver having 3 units, so I’ve setup my server statements to use all 3. / /

NTP is happy with unit 2 (*), and has selected unit 1 as the secondary (+), and does not like unit 0 (x).

The GPS is being read from /dev/ttyAMA0
The PPS is via GPIO4 and /dev/pps0
I’ve loaded the GPSD config to reach both devices.

Honestly, I have no idea what each of the units means. How do I know which is the GPS time hacks, and which is the PPS hacks? I can’t find any good description of what the different units are.

I’m using the distribution versions of GPSD (3.17) and NTP (4.2.8P12) - not from GIT or any other sources.

Thank you!

Basically there are 4 shared memory units, so you could provide ntpd with timestamps from up to 4 different hardware reference clocks (e.g., GPS receivers).

There are different programs that can feed timestamps into one or more SHM units, for example gpsd, or the daemon that ships with the driver package for Meinberg GPS PCI cards.

I’m not familiar with gpsd, but I’m assuming it feeds the serial time stamps into one SHM unit, and the PPS timestamps into another unit. I doubt that a 3rd unit is used at all by gpsd.

Unfortunately I can’t tell whether gpsd uses units 0 and 1, or 1 and 2, or whatever, but I think it’s a question of configuration of gpsd.

There’s a nice overview @ https://blog.thelifeofkenneth.com/2020/03/building-raspberry-pi-stratum-1-ntp.html which shows the same approach I’m using pretty successfully: PPS via kernel (mode 22 @ https://www.eecis.udel.edu/~mills/ntp/html/drivers/driver22.html) and NMEA GPS via SHM (mode 28 @ https://www.eecis.udel.edu/~mills/ntp/html/drivers/driver28.html).

Regarding 127.127.2x.u, it is 127.127.2x.0 for /dev/pps0, 127.127.2x.1 for /dev/pps1, 127.127.2x.2 for /dev/pps2.

Just remember that driver 28 uses time1 for the calibration offset in ntp.conf, not time2!

1 Like