This commit is contained in:
129
content/snippets/0240-timeserver.md
Normal file
129
content/snippets/0240-timeserver.md
Normal file
@ -0,0 +1,129 @@
|
||||
<!--
|
||||
title: Just another Stratum 1 Timeserver
|
||||
date: 2025-02-11
|
||||
-->
|
||||
|
||||
|
||||

|
||||
|
||||
This server utilizes `ntpsec` on Debian on a BeagleBone Black with a UBlox GPS module.
|
||||
|
||||
It has been joined the NTP pool, the statistics are available at [https://www.ntppool.org/scores/93.241.86.156](https://www.ntppool.org/scores/93.241.86.156).
|
||||
|
||||
Some additional statistics graphs for the server are available at [https://numbers.hottis.de/ntpserver](https://numbers.hottis.de/ntpserver).
|
||||
|
||||
|
||||
## Preparation of the BeagleBone
|
||||
|
||||
The GPS module is connected via serial line to the UART of the BB.
|
||||
|
||||
The additional connection of the PPS output with the PPS device of the Linux running on the BB via a GPIO must be prepared. A device tree overlay must be created and compiled:
|
||||
|
||||
```
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/{
|
||||
compatible = "ti,beaglebone", "ti,beaglebone-black";
|
||||
part_number = "WN-PPS";
|
||||
version = "00A0";
|
||||
|
||||
exclusive-use =
|
||||
"P8.7",
|
||||
"gpio2_2";
|
||||
|
||||
fragment@0 {
|
||||
target = <&am33xx_pinmux>;
|
||||
__overlay__ {
|
||||
bs_pinmode_P8_7_0x27: pinmux_bs_pinmode_P8_7_0x27 {
|
||||
pinctrl-single,pins = <0x090 0x27>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&ocp>;
|
||||
__overlay__ {
|
||||
bs_pinmode_P8_7_0x27_pinmux {
|
||||
compatible = "pps-gpio";
|
||||
status = "okay";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&bs_pinmode_P8_7_0x27>;
|
||||
gpios = <&gpio2 2 0>;
|
||||
assert-rising-edge;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
This file shall be compiled using
|
||||
|
||||
```
|
||||
dtc -O dtb -o WN-PPS-00A0.dtbo -b 0 -@ WN-PPS-00A0.dts
|
||||
```
|
||||
|
||||
The binary dtbo file then copied into `/lib/firmware` and mentioned in the `/boot/uEnv.txt`:
|
||||
|
||||
```
|
||||
uboot_overlay_addr0=/lib/firmware/WN-PPS-00A0.dtbo
|
||||
```
|
||||
|
||||
After a reboot the device file `/dev/pps0` should be available and using `ppstest /dev/pps0` you can test the connection:
|
||||
|
||||
```
|
||||
root@david:/boot# ppstest /dev/pps0
|
||||
trying PPS source "/dev/pps0"
|
||||
found PPS source "/dev/pps0"
|
||||
ok, found 1 source(s), now start fetching data...
|
||||
source 0 - assert 1739442756.999984966, sequence: 306598 - clear 0.000000000, sequence: 0
|
||||
source 0 - assert 1739442757.999978472, sequence: 306599 - clear 0.000000000, sequence: 0
|
||||
source 0 - assert 1739442758.999976057, sequence: 306600 - clear 0.000000000, sequence: 0
|
||||
^C
|
||||
root@david:/boot#
|
||||
```
|
||||
|
||||
|
||||
## Configuration of the ntpsec daemon
|
||||
|
||||
|
||||
```
|
||||
interface listen all
|
||||
logconfig +all
|
||||
logfile /var/log/ntp.log
|
||||
|
||||
statsdir /var/log/ntpsec/
|
||||
statistics loopstats peerstats clockstats protostats sysstats rawstats
|
||||
filegen loopstats file loopstats type day disable
|
||||
filegen peerstats file peerstats type day enable
|
||||
filegen clockstats file clockstats type day enable
|
||||
filegen protostats file protostats type day enable
|
||||
filegen sysstats file sysstats type day enable
|
||||
filegen rawstats file rawstats type day disable
|
||||
|
||||
driftfile /var/lib/ntpsec/ntp.drift
|
||||
leapfile /usr/share/zoneinfo/leap-seconds.list
|
||||
|
||||
tos maxclock 11
|
||||
tos minclock 4 minsane 3
|
||||
|
||||
refclock nmea unit 0 prefer mode 0x10 minpoll 4 maxpoll 4 path /dev/ttyO4 ppspath /dev/pps0 baud 9600 flag1 1 refid BBgp
|
||||
# refclock shm unit 0 refid BBg minpoll 4 maxpoll 4 time1 0.1555
|
||||
# refclock shm unit 2 refid BBp minpoll 4 maxpoll 4 prefer
|
||||
# refclock pps unit 0 prefer refid BBp ppspath /dev/pps0 minpoll 4 maxpoll 4
|
||||
# refclock gpsd unit 0 prefer refid BBgp mode 1 minpoll 4 maxpoll 4
|
||||
|
||||
server ntps1-1.uni-erlangen.de
|
||||
server ntps1-0.cs.tu-berlin.de
|
||||
server ptbtime1.ptb.de
|
||||
server rustime01.rus.uni-stuttgart.de
|
||||
server ntp1.sda.t-online.de
|
||||
server ntps1.gwdg.de
|
||||
|
||||
restrict default kod nomodify nopeer noquery limited notrap
|
||||
restrict 127.0.0.1
|
||||
restrict ::1
|
||||
```
|
||||
|
||||
Although the `nmea` reference clock driver is obsolete according to [https://ntpsec.org/removal-plan.html](https://ntpsec.org/removal-plan.html), it works perfectly for me, in particular better then the other drivers. However, maybe I was not trying hard enough with the others.
|
||||
|
Reference in New Issue
Block a user