Note - do not install NTPD as part of FreeBSD install, NTPD and Chrony cannot be run simultaneously.
Code: Select all
vi /etc/ttysCode: Select all
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.
#ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure
#ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure
#ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure
#ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure
Code: Select all
kldload ppsCode: Select all
kldstatCode: Select all
vi /boot/loader.conf
Code: Select all
pps_load="YES"
Code: Select all
pkg install gpsdCode: Select all
vi /etc/rc.confCode: Select all
gpsd_enable="YES"
gpsd_devices="/dev/cuau0 /dev/cuau1 /dev/cuau2 /dev/cuau3"
gpsd_flags="-n -s 115200 -f 8N1"
-s 115200 flag: Fix the serial port speed to the GNSS device. Allowed speeds are: 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800 and 921600. The default is to autobaud.
-f 8N1 flag: Fix the framing to the GNSS device. The framing parameter is of the form: [78][ENO][012]. Most GNSS are 8N1. Some Trimble default to 8O1. The default is to search for the correct framing.
You can now use these commands for control:
Code: Select all
service gpsd status
service gpsd stop
service gpsd start
gpsd -n -s 115200 -f 8N1 /dev/cuau0 /dev/cuau1 /dev/cuau2 /dev/cuau3 &
pkill gpsd
Code: Select all
gpsmon -n localhost:2947:/dev/cuau0
gpsmon -n localhost:2947:/dev/cuau1
gpsmon -n localhost:2947:/dev/cuau2
gpsmon -n localhost:2947:/dev/cuau3
cgps -s localhost:2947:/dev/cuau0
cgps -s localhost:2947:/dev/cuau1
cgps -s localhost:2947:/dev/cuau2
cgps -s localhost:2947:/dev/cuau3
If your PPS is coming in on the CTS pin instead of DCD, you can run these commands:
Code: Select all
sysctl dev.uart.0.pps_mode=1
sysctl dev.uart.1.pps_mode=1
sysctl dev.uart.2.pps_mode=1
sysctl dev.uart.3.pps_mode=1
Code: Select all
vi /boot/loader.conf
Code: Select all
dev.uart.0.pps_mode="1"
dev.uart.1.pps_mode="1"
dev.uart.2.pps_mode="1"
dev.uart.3.pps_mode="1"
You may also set flags for inverted and/or narrow pulses, read more here:
https://man.freebsd.org/cgi/man.cgi?uart(4)
Code: Select all
pkg install chronyCode: Select all
vi /etc/rc.confCode: Select all
chronyd_enable="YES"
Make a backup of the chrony config file:The SOCK refclocks should be preferred over SHM for better security (the shared memory segment needs to be created by chronyd or gpsd with an expected owner and permissions before an untrusted application or user has a chance to create its own in order to feed chronyd with false measurements). gpsd needs to be started after chronyd in order to connect to the socket.
Code: Select all
cp /usr/local/etc/chrony.conf /usr/local/etc/chrony.conf.bak
Code: Select all
vi /usr/local/etc/chrony.conf
Code: Select all
refclock SOCK /var/run/chrony.cuau0.sock refid GPS1
refclock SOCK /var/run/chrony.cuau1.sock refid GPS2
refclock SOCK /var/run/chrony.cuau2.sock refid GPS3
refclock SOCK /var/run/chrony.cuau3.sock refid GPS4
Code: Select all
service chronyd status
service chronyd stop
service chronyd start
chronyc makestep => set system time correct to NTP time
Code: Select all
while true; do clear; chronyc sources; echo "" ;chronyc sourcestats ; echo ""; chronyc tracking; sleep 1; done
chronyc clients => who is using my ntp-server?
chronyc ntpdata => give a lot of info about all your sources incl remote - sort of multi-tracking
chronyc serverstats => stats of packets, send, received and dropped.