I am configuring chrony (3.1 from buildroot) for an isolated system with an
attached GPS+PPS and trying to get it to set the system time as quickly as
possible. The device does not have a battery-backed RTC and will never have
access to a network. It boots with the system time of 1970-01-01T00:00:00.

The PPS is attached to /dev/pps0 and I have confirmed it is working:
# 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 3196.416134924, sequence: 3137 - clear  0.000000000,
sequence: 0
source 0 - assert 3197.416137528, sequence: 3138 - clear  0.000000000,
sequence: 0
source 0 - assert 3198.416140809, sequence: 3139 - clear  0.000000000,
sequence: 0
source 0 - assert 3199.416151381, sequence: 3140 - clear  0.000000000,
sequence: 0

The GPS is connected through gpsd using the SHM driver, and I've confirmed
it is working (refclock log is below). Here is my chrony.conf:
# cat /etc/chrony.conf
refclock PPS /dev/pps0 lock NMEA
refclock SHM 0 offset 0.5 delay 0.2 refid NMEA noselect
log refclocks
logdir /var/log

Starting chronyd with debugging information suggests that chrony is aware
of the PPS clock:
# chronyd -d -d
1970-01-01T01:03:32Z main.c:473:(main) chronyd version 3.1 starting
1970-01-01T01:03:32Z conf.c:406:(CNF_ReadFile) Reading /etc/chrony.conf
1970-01-01T01:03:32Z local.c:149:(calculate_sys_precision) Clock precision
0.000000260 (-22)
1970-01-01T01:03:32Z sys_linux.c:317:(get_version_specific_details) Linux
kernel major=4 minor=9 patch=45
1970-01-01T01:03:32Z sys_linux.c:338:(get_version_specific_details) hz=100
nominal_tick=10000 max_tick_bias=1000
1970-01-01T01:03:32Z local.c:663:(lcl_RegisterSystemDrivers) Local
1970-01-01T01:03:32Z refclock.c:274:(RCL_AddRefclock) refclock PPS
refid=PPS0 poll=4 dpoll=0 filter=16
1970-01-01T01:03:32Z refclock.c:274:(RCL_AddRefclock) refclock SHM
refid=NMEA poll=4 dpoll=0 filter=16
1970-01-01T01:03:32Z refclock.c:442:(RCL_AddPulse) refclock pulse ignored
no ref sample
1970-01-01T01:03:32Z refclock.c:723:(filter_add_sample) filter sample 0
t=3812.539035837 offset=1505092242.960964203 dispersion=0.000001000
1970-01-01T01:03:33Z refclock.c:465:(RCL_AddPulse) refclock pulse ignored
offdiff=0.379203081 refdisp=0.000001260 disp=0.000000001
1970-01-01T01:03:33Z refclock.c:723:(filter_add_sample) filter sample 1
t=3813.537794586 offset=1505092242.962205410 dispersion=0.000001000
1970-01-01T01:03:34Z refclock.c:465:(RCL_AddPulse) refclock pulse ignored
offdiff=0.380447388 refdisp=0.000001260 disp=0.000000001
1970-01-01T01:03:34Z refclock.c:723:(filter_add_sample) filter sample 2
t=3814.536533857 offset=1505092242.963466167 dispersion=0.000001000
1970-01-01T01:03:35Z refclock.c:465:(RCL_AddPulse) refclock pulse ignored
offdiff=0.381711483 refdisp=0.000001260 disp=0.000000001
1970-01-01T01:03:35Z refclock.c:723:(filter_add_sample) filter sample 3
t=3815.537782398 offset=1505092242.962217569 dispersion=0.000001000
1970-01-01T01:03:36Z refclock.c:465:(RCL_AddPulse) refclock pulse ignored
offdiff=0.380466461 refdisp=0.000001260 disp=0.000000001
1970-01-01T01:03:36Z refclock.c:723:(filter_add_sample) filter sample 4
t=3816.537785262 offset=1505092242.962214708 dispersion=0.000001000
1970-01-01T01:03:37Z refclock.c:465:(RCL_AddPulse) refclock pulse ignored
offdiff=0.380466938 refdisp=0.000001260 disp=0.000000001
1970-01-01T01:03:37Z refclock.c:723:(filter_add_sample) filter sample 5
t=3817.537906252 offset=1505092242.962093830 dispersion=0.000001000
1970-01-01T01:03:38Z refclock.c:465:(RCL_AddPulse) refclock pulse ignored
offdiff=0.380349398 refdisp=0.000001260 disp=0.000000001
1970-01-01T01:03:38Z refclock.c:723:(filter_add_sample) filter sample 6
t=3818.536778178 offset=1505092242.963221788 dispersion=0.000001000

The refclock log never shows any output for PPS0:
# cat /var/log/refclocks.log
   Date (UTC) Time         Refid  DP L P  Raw offset   Cooked offset
1970-01-01 01:03:32.539035 NMEA    0 N 0  1.505092e+09  1.505092e+09
1970-01-01 01:03:33.537794 NMEA    1 N 0  1.505092e+09  1.505092e+09
1970-01-01 01:03:34.536533 NMEA    2 N 0  1.505092e+09  1.505092e+09
1970-01-01 01:03:35.537782 NMEA    3 N 0  1.505092e+09  1.505092e+09
1970-01-01 01:03:36.537785 NMEA    4 N 0  1.505092e+09  1.505092e+09
1970-01-01 01:03:37.537906 NMEA    5 N 0  1.505092e+09  1.505092e+09

The sources report shows:
# chronyc sources
210 Number of sources = 2
MS Name/IP address         Stratum Poll Reach LastRx Last sample

#? PPS0                          0   4     0     -     +0ns[   +0ns] +/-
#? NMEA                          0   4   377    22  -17420d[-17420d] +/-

Further help with synchronising to the PPS would be appreciated, as would
any configuration advice for an isolated system with a large time delta at
boot (I am considering 'makestep 0.1 300' assuming 5 minutes for the GPS to
acquire lock).

Reply via email to