FreeBSD 14 USB VK‐162 - BYO-NTP/recipes GitHub Wiki
date | server | os | gnss | daemon | 🎯 | 🗣️ |
---|---|---|---|---|---|---|
2025-05 | Raspberry Pi 4 Raspberry Pi 5 Chuwi Larkbox X |
FreeBSD 14 |
Stratux VK-162 u-blox 7 |
chrony NTPsec ntp |
3 ms 3 ms 7 ms |
discuss discuss discuss |
Install instructions for Pi 4, Pi 5, Chuwi Larkbox
Connect the USB plug to a Windows computer that has u-blox u-center installed. Configure per the recommendations on the gnss page.
When a USB device is plugged in, FreeBSD emits a couple lines of text to the console and dmesg:
dmesg | grep -i gps
ugen1.6: <u-blox AG - www.u-blox.com u-blox 7 - GPS/GNSS Receiver> at usbus1
umodem0: <u-blox AG - www.u-blox.com u-blox 7 - GPS/GNSS Receiver, class 2/0, rev 1.10/1.00, addr 5> on usbus1
That output tells us the device was attached with the umodem
driver so we can read the docs for umodem and determine that the USB device was attached at /dev/cuaU*
.
ls /dev/cuaU*
And there we find cuaU0
!
/dev/cuaU0 /dev/cuaU0.init /dev/cuaU0.lock
The NTP daemons look to /dev/gps0
by default, so link gps0
to the serial port using devfs:
test -L /dev/gps0 && rm /dev/gps0
grep -q gps0 /etc/devfs.conf && sed -i '' -e 's/^link.*gps0$//g' /etc/devfs.conf
echo 'link cuaU0 gps0' >> /etc/devfs.conf
service devfs restart
Each section heading is a link with many more details about installing, configuring, and verifying that particular NTP daemon.
export NTP_REFCLOCKS=$(cat <<EO_CHRONY
refclock SHM 0 refid NMEA offset 0.054 precision 0.04 poll 4 trust
EO_CHRONY
)
curl -sS https://byo-ntp.github.io/tools/chrony/install.sh | sh
Note: on the pi4, I needed offset -0.009
When used with USB connected GNSS, the gpsd
driver typically increases precision by a decimal place, so it's the default here:
export NTP_REFCLOCKS=$(cat <<EO_NTPSEC
refclock gpsd minpoll 1 maxpoll 3 time2 0.05 mode 2 prefer
#refclock nmea minpoll 3 maxpoll 4 time2 0.05 baud 115200 mode 8 prefer
EO_NTPSEC
)
curl -sS https://byo-ntp.github.io/tools/ntpsec/install.sh | sh
export NTP_REFCLOCKS=$(cat <<EO_NTP_NMEA
server 127.127.20.0 minpoll 3 maxpoll 4 mode 88 prefer
fudge 127.127.20.0 refid NMEA time2 0.048 minjitter 0.05
EO_NTP_NMEA
)
curl -sS https://byo-ntp.github.io/tools/ntp/install.sh | sh
Alternatively, using ntp's GPSD-NG driver with gpsd:
export NTP_REFCLOCKS=$(cat <<EO_NTP_GPSD
server 127.127.46.0 minpoll 3 maxpoll 4 mode 0 prefer
fudge 127.127.46.0 refid NMEA time2 0.05 minjitter 0.05
EO_NTP_GPSD
)
curl -sS https://byo-ntp.github.io/tools/ntp/install.sh | sh
gpsd_devices="/dev/cuaU0"
service gpsd restart
service ntpd restart
- watch the status in near real time (requires installing gnu-watch):
- printf '\e[8;9;80t'; ssh -t pi5 gnu-watch -n2 chronyc sources
- printf '\e[8;9;80t'; ssh -t pi5 gnu-watch -n2 ntpq -c peer
- Measure the offset
- Gather statistics with telegraf + influxdb + grafana or similar.
- FreeBSD umodem
- GNSS
- NTP daemons
chrony
NTPsec
ntp