Recently, I bought a Wyse 5070 thin client and planned to turn it into an internal network comprehensive server. One of the goals is to set up a precise internal NTP server. Therefore, I used the existing GNSSDO’s PPS signal output through RS-232 DCD input to the thin client and used it as a PPS signal source to tame chronyd. The date and time information can be obtained either via NEMA messages or other NTP servers.
Install and configure of software packages:
$ sudo apt install gpsd chrony pps-tools
Write /etc/systemd/system/ldattach-pps@.service to use RS-232 DCD as a PPS source every time the system boots:
1 | [Unit] |
sudo systemctl enable ldattach-pps@ttyS0.service
Write the gpsd configuration file:
1 | START_DAEMON="true" |
Write the chrony configuration file /etc/chrony/sources.d/gps.sources, which can be referenced from https://chrony-project.org/doc/3.4/chrony.conf.html. delay is used to ensure that the server selects PPS as a reference source, poll 1 represents polling the clock source every two seconds, offset is used to compensate for the overall time difference between PPS and RS-232 output, but it’s not significant under discipline by PPS. width 0.1 explicitly declares the pulse width of the PPS signal, which is said to reduce jitter.
1 | refclock SHM 0 refid GPS offset 0.1642 delay 0.2 poll 1 |
If using an external NTP server as the source of date and time, you can add the following list to /etc/chrony/sources.d/external-server.sources. minpoll 10 ensures that the polling interval is at least 1024 seconds; by default it’s 6, which may be too frequent.
1 | server ntp.ntsc.ac.cn iburst minpoll 10 |
At this point, you can start chronyd and gpsd and observe the running status.
$ sudo systemctl restart chronyd sudo systemctl restart gpsd watch -n1 chronyc sources -v
I made a poor PPS to RS-232 DCD adapter cable by direct connect DCD to PPS output of GPS Receiver. Although it severely deviates from the voltage standard, it works well: (so I didn’t finally use ttyS0 as GPS NEMA message transmission link, but instead used Ublox USB CDC-ACM)