Linux – chrony and gpsd: socket or PPS connection

chronygpslinuxtime-synchronization

I've try to get high precision time from gps receiver GlobalSat BU-353s4 (/dev/ttyUSB0) through gpsd in Raspberry PI with ArchLinux.

/etc/chrony.conf contains:

refclock SHM 0  delay 0.5 refid NEMA
refclock SHM 1 offset 0.0 delay 0.1 refid PPS
refclock SOCK /var/run/chrony.ttyUSB0.sock delay 0.0 refid SOCK

I've get time through NEMA (SHM 0 source) (but with low accuracy).

gpsd did not find kernel PPS extension, as the result SHM 1 source did not working:

gpsd:WARN: KPPS:/dev/ttyUSB0 kernel PPS unavailable, PPS accuracy will suffer

But lsmod shows that pps modules is loaded:

# lsmod
Module                  Size  Used by
pps_ldisc               2305  0
pps_core                7982  1 pps_ldisc

Socket source also did not working:

# chronyc sources
210 Number of sources = 9
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
#x NEMA                          0   4   377    18   -532ms[ -532ms] +/-  252ms
#? SOCK                          0   4     0     -     +0ns[   +0ns] +/-    0ns

But gpsd -N -D8 /dev/ttyUSB0 shows that sock file is opened:

gpsd:RAW: PPS:/dev/ttyUSB0 using chrony socket: /var/run/chrony.ttyUSB0.sock

The question: How to make kernel PPS available for gpsd or make the socket work?

Best Answer

First, pps is NOT available via USB. You need to use a direct connection. USB is polled and thus cannot provide an accurate enough signal. I learned this trying to set up some Windows boxes at work.

Your GPS module doesn't have PPS out, it will be on a separate pin or connector. This needs to be connected to a GPIO pin on the Pi.

I have just set up two Pi's for ntp and this is the site I used for reference using the Adafruit GPS module. (Picture with blue box)

http://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html

I fought with the second one because I didn't have a GPS lock as I needed a second antenna and it was raining outside.

Related Topic