[chrony-users] Integrating chrony with gpsd

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]


I wonder if anyone can help....this is mainly a chronyd question, with a bit of gpsd thrown in....

I have been trying to setup chronyd to grab time from a USB connected GPS module. 
The module has a RTC and battery backup, so the NMEA strings contain a valid time even when there is no fix. 

gpsd has been set up successfully, using the following config file: 
# Start the gpsd daemon automatically at boot time
START_DAEMON="true"

# Use USB hotplugging to add new USB devices automatically to the daemon
USBAUTO="true"

# Devices gpsd should collect to at boot time.
# They need to be read/writeable, either by user gpsd or the group dialout.
DEVICES="/dev/ttyUSB1"
# Other options you want to pass to gpsd
GPSD_OPTIONS="-n"

And using cgps I can see the time. In addition, I can telnet into gpsd and see the time: 
pi@raspberrypi:~ $ telnet 127.0.0.1 2947
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
{"class":"VERSION","release":"3.17","rev":"3.17","proto_major":3,"proto_minor":12}
?WATCH={"enable":true,"json":true}
{"class":"DEVICES","devices":[{"class":"DEVICE","path":"/dev/ttyUSB1","driver":"MTK-3301","subtype":"AXN_2.31_3339_13101700-5632","activated":"2020-12-11T12:18:02.791Z","flags":1,"native":0,"bps":9600,"parity":"N","stopbits":1,"cycle":1.00,"mincycle":0.20}]}
{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false}
{"class":"TPV","device":"/dev/ttyUSB1","mode":1,"time":"2020-12-11T12:33:17.086Z","ept":0.005}
{"class":"TPV","device":"/dev/ttyUSB1","mode":1,"time":"2020-12-11T12:33:18.086Z","ept":0.005}
{"class":"TPV","device":"/dev/ttyUSB1","mode":1,"time":"2020-12-11T12:33:19.086Z","ept":0.005}
{"class":"TPV","device":"/dev/ttyUSB1","mode":1,"time":"2020-12-11T12:33:20.086Z","ept":0.005}
{"class":"TPV","device":"/dev/ttyUSB1","mode":1,"time":"2020-12-11T12:33:21.086Z","ept":0.005}
{"class":"TPV","device":"/dev/ttyUSB1","mode":1,"time":"2020-12-11T12:33:22.086Z","ept":0.005}
{"class":"TPV","device":"/dev/ttyUSB1","mode":1,"time":"2020-12-11T12:33:23.086Z","ept":0.005}

I have set up chronyd using the following config file: 
  GNU nano 3.2                                       /etc/chrony/chrony.conf                                                  

driftfile /var/lib/chrony/drift

# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3

# Specify file containing keys for NTP authentication.
keyfile /etc/chrony.keys

# Get TAI-UTC offset and leap seconds from the system tz database.
leapsectz right/UTC

# Specify directory for log files.
logdir /var/log/chrony
refclock SHM 0 offset 0.5 delay 0.2 refid NMEA

However, my chrony status is always:

Code: Select all

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
#? NMEA                          0   4     0     -     +0ns[   +0ns] +/-    0ns

If I am correct, then the "?" means chronyd can not connect to gpsd...? 

This test was carried out when the GPS had no fix - should I expect chronyd to get time successfully in the absence of a GPS fix in this scenario (since the NMEA strings do still contain time thanks to the RTC)....or is there some other issue I am missing? 

Cheers!



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/