beta-tester/RPi-GPS-PPS-StratumOne

Explanation why so many sources?

jtrmal opened this issue · 4 comments

Hi, why is there so many alternative sources of the PPS signal? I'm kinda confused about the purpose. I understand they should be more or less of the same precision (because they stem from a single source), but then why they are getting defined?
Also, I'm getting all other sources (other from PSM0) marked as '?'

MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
#? PPS0                          0   3   377    12  +1468ns[+1601ns] +/-  504ns
#? GPS0                          0   3   377    12    -25ms[  -25ms] +/-  100ms
#* PSM0                          0   3   377    12  +1468ns[+1601ns] +/-  501ns
#? PST0                          0   3   377    12  +1468ns[+1468ns] +/-  483ns
^? ntp1.karneval.cz              2   4   377    15  -1641us[-1641us] +/-   24ms
^? inter.tyjo.eu                 2   4   377    16   -868us[ -868us] +/- 4832us
^? herbrand.noumicek.cz          2   4   377    14  -2697us[-2697us] +/-   49ms
^? time.cloudflare.com           3   4   377     1  -2959us[-2959us] +/-   13ms

hi,

i just offer all the possible sources that chrony can use.
you can choose the source that fits you purpose best.

PPS0 is the /dev/pps0 itself, provided by the kernel.
GPS0 is the NMEA output of the GPS device comming over the serial port processed by the gpsd daemon.
PSM0 is the shared memory version of NMEA + PPS0 processed by gpsd daemon
PST0 is the socket version of NMEA + PPS0 processed by gpsd daemon.

GPS0 is normally the less accurate source. but some GPS devices have a battery buffered RTC (real time clock) that provides quickly a relarive good time wihtout satellites FIX.

PPS0 is normally comming, when the GPS device is having a FIX - means after a warm or a cold start it takes its time until a PPS0 signal will be received by the kernel. but chrony has a specific requirement to get that source accepted.
PPS0 and NMEA has to be not more off than +/.200ms if that requirement is not fullfilled it can be that PPS0 will not be selected by chrony as source.

PSM0 and PST0 are also NMAE + PPS0 but these sources do not underly the strict requirements as PPS0 do. gpsd is doing the "merge" of NMEA and PPS. so mostely PSM0 will be the quichest of the accurate sources that chrony selects.

PST0 is a bit picky as it will go lost/break in case you only restart the gpsd daemon for some reason.
you have to choose the right sequence to get it restarted and "accepted" by chrony again.

sudo systemctl stop --now gpsd.{service,socket} && sudo systemctl stop --now chrony && \
sudo systemctl start --now chrony && sudo systemctl start --now gpsd

so to increase that at least one of the sources get catched by chrony as reliable as quick as possible, there i added all in the source list.

PPS0, PSM0 and PST0 have the same accuracy/precision
so if you do not often restart the services or reboot the system or make a warm/cold start of your GPS you can use only PSM0 as source.

and the other random sources from the pool/internet i added as an example and in the case that there is something wrong with the GPS device (connection/setting) to get the time from the internet because installing packages may need a relative good time otherwise packages can be rejected.
also in case there are not enough satellites in view /interferences/noise to get a FIX to have an alternative source from the internet.

that you only get one source marked as '*' used is absolute normal. read the document of chrony. chrony chooses the best time source and keep track of that source as long no better source is available.

different as ntpd where you need at least three reliable timesources to keep track.

oh, i saw something i forgot to tell you...

the '?' infront comes because i set all sources except PSM0 to noselect in the file:
/etc/chrony/stratum1/10-refclocks-pps0.conf

i can't really remember why i did it.
maybe it was because PPS0, PSM0 and PST0 do have the same precision and chrony was hopping between these sources frequently.

you can remove the noselect option from the entries in the file.