Linux Zeitsynchronisation mit GPS

Aus Port23Wiki
Wechseln zu: Navigation, Suche

Fedora Linux

USB GPS Empfänger:

lsusb
Bus 005 Device 003: ID 1546:01a8 U-Blox AG [u-blox 8]

GPS Daemon installieren:

gpsd-3.23.1-2.fc36.x86_64

Datei /etc/sysconfig/gpsd anpassen:

cat /etc/sysconfig/gpsd
# Options for gpsd, including serial devices
OPTIONS=""
# Set to 'true' to add USB devices automatically via udev
USBAUTO="true"
#
#
DEVICES="/dev/ttyACM0"
GPSD_OPTIONS="-n"

Kommando aufrufen:

gpsctl -n   # setzt den Ausgabe Modus / turn NMEA output on or off 

Gpsmon aufrufen und Funktion/Empfang prüfen:

gpsmon
gpsmon 127.0.0.1:2947

Datei /etc/chrony.conf anpassen:

/etc/chrony.conf

refclock SHM 0 refid NMEA offset 0.040 # offset erforderlich; Abgleich mit gutem NTP Server (z. B. PTB)

Grund:

  • https://www.lammertbies.nl/comm/info/gps-time
    • Although the clock inside the receiver itself runs with an accuracy of some nanoseconds, the transfer of the data to the computer causes such a large delay, that in practice it is not possible to synchronize the clock of the local computer with that signal with an accuracy of better than a handful of milliseconds.

GPS receiver mit "noselect" in u. a. Ausgabe deaktiviert:

# chronyc sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
#? NMEA                          0   4   377    23   -328us[ -328us] +/-  164us
^* ntp.netnod.se                 1  10   377  1004  -1285us[-1263us] +/-   18ms
^+ any.time.nl                   2  10   377    25   -316us[ -316us] +/-   22ms
^+ ntp3.lrz.de                   1  10   377    93  +4330us[+4330us] +/-   34ms


Hinweise auf https://austinsnerdythings.com/2021/09/29/millisecond-accurate-chrony-ntp-with-a-usb-gps-for-12-usd/ beachten.

Meine Werkzeuge