Code: Select all
sudo apt updateCode: Select all
sudo apt upgradeCode: Select all
sudo apt install linuxptp chrony gpsd gpsd-clients pps-toolsCode: Select all
sudo lshw -class network -shortccb056@tick:~$ sudo lshw -class network -short
H/W path Device Class Description
========================================================
/0/100/1c.5/0 eno2 network I210 Gigabit Network Connection
/0/100/1f.6 eno1 network Ethernet Connection I219-LM
Code: Select all
ethtool -T eno1Code: Select all
ethtool -T eno2Note:ccb056@tick:~$ ethtool -T eno1
Time stamping parameters for eno1:
Capabilities:
hardware-transmit
software-transmit
hardware-receive
software-receive
software-system-clock
hardware-raw-clock
PTP Hardware Clock: 1
Hardware Transmit Timestamp Modes:
off
on
Hardware Receive Filter Modes:
none
all
ptpv1-l4-sync
ptpv1-l4-delay-req
ptpv2-l4-sync
ptpv2-l4-delay-req
ptpv2-l2-sync
ptpv2-l2-delay-req
ptpv2-event
ptpv2-sync
ptpv2-delay-req
ccb056@tick:~$ ethtool -T eno2
Time stamping parameters for eno2:
Capabilities:
hardware-transmit
software-transmit
hardware-receive
software-receive
software-system-clock
hardware-raw-clock
PTP Hardware Clock: 0
Hardware Transmit Timestamp Modes:
off
on
Hardware Receive Filter Modes:
none
all
eno1 (Intel I219-LM) has PTP Hardware Clock: 1 - meaning /dev/ptp1
eno2 (Intel I210) has PTP Hardware Clock: 0 - meaning /dev/ptp0
Code: Select all
sudo phc_ctl eno1ccb056@tick:~$ sudo phc_ctl eno1
phc_ctl[1117.647]:
capabilities:
999999999 maximum frequency adjustment (ppb)
0 programable alarms
0 external time stamp channels
0 programmable periodic signals
0 configurable input/output pins
doesn't have pulse per second support
has cross timestamping support
doesn't have adjust phase support
Code: Select all
sudo phc_ctl eno2Use ptp4l to set the PHC via PTP:ccb056@tick:~$ sudo phc_ctl eno2
phc_ctl[1145.484]:
capabilities:
62499999 maximum frequency adjustment (ppb)
0 programable alarms
2 external time stamp channels
2 programmable periodic signals
4 configurable input/output pins
has pulse per second support
doesn't have cross timestamping support
doesn't have adjust phase support
Code: Select all
sudo ptp4l -i eno1 -m --summary_interval 1compared with:ccb056@tick:~$ sudo ptp4l -i eno1 -m --summary_interval 1
ptp4l[4274.737]: selected /dev/ptp1 as PTP clock
ptp4l[4274.738]: port 1 (eno1): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[4274.738]: port 0 (/var/run/ptp4l): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[4274.738]: port 0 (/var/run/ptp4lro): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[4276.580]: port 1 (eno1): new foreign master 2ccf67.fffe.dc63ab-1
ptp4l[4280.580]: selected best master clock 2ccf67.fffe.dc63ab
ptp4l[4280.580]: port 1 (eno1): LISTENING to UNCALIBRATED on RS_SLAVE
ptp4l[4283.353]: rms 37072533447 max 37072537036 freq +3589 +/- 3589 delay 6798 +/- 189
ptp4l[4284.353]: port 1 (eno1): UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
ptp4l[4285.353]: rms 205 max 249 freq +7151 +/- 177 delay 6798 +/- 0
ptp4l[4287.353]: rms 1236 max 1733 freq +5909 +/- 493 delay 7717 +/- 687
ptp4l[4289.353]: rms 865 max 972 freq +6564 +/- 746 delay 9691 +/- 54
ptp4l[4291.353]: rms 849 max 1199 freq +7440 +/- 389 delay 9745 +/- 31
ptp4l[4293.353]: rms 468 max 627 freq +7460 +/- 239 delay 9772 +/- 0
ptp4l[4295.353]: rms 192 max 235 freq +7231 +/- 165 delay 9795 +/- 33
ptp4l[4297.353]: rms 68 max 95 freq +7161 +/- 26 delay 9880 +/- 0
ptp4l[4299.354]: rms 150 max 172 freq +7247 +/- 123 delay 9900 +/- 20
ptp4l[4301.358]: rms 57 max 79 freq +7240 +/- 45 delay 9920 +/- 0
ptp4l[4303.354]: rms 284 max 399 freq +7509 +/- 120 delay 9856 +/- 24
ptp4l[4305.354]: rms 160 max 216 freq +7188 +/- 43 delay 9833 +/- 0
ptp4l[4307.354]: rms 95 max 117 freq +7261 +/- 81 delay 9822 +/- 0
ptp4l[4309.354]: rms 24 max 26 freq +7289 +/- 2 delay 9822 +/- 0
ptp4l[4311.354]: rms 278 max 362 freq +7435 +/- 203 delay 9822 +/- 0
ptp4l[4313.354]: rms 204 max 288 freq +7189 +/- 141 delay 9822 +/- 0
ptp4l[4315.353]: rms 20 max 22 freq +7273 +/- 1 delay 9801 +/- 6
ptp4l[4317.354]: rms 164 max 231 freq +7401 +/- 92 delay 9793 +/- 0
ptp4l[4319.354]: rms 225 max 300 freq +7242 +/- 186 delay 9793 +/- 0
ptp4l[4321.353]: rms 20 max 28 freq +7283 +/- 12 delay 9782 +/- 0
ptp4l[4323.354]: rms 177 max 249 freq +7447 +/- 78 delay 9769 +/- 8
ptp4l[4325.354]: rms 279 max 311 freq +7043 +/- 70 delay 9780 +/- 0
ptp4l[4327.354]: rms 123 max 165 freq +7309 +/- 63 delay 9763 +/- 0
ptp4l[4329.354]: rms 183 max 256 freq +7110 +/- 110 delay 9763 +/- 0
ptp4l[4331.354]: rms 220 max 231 freq +7238 +/- 185 delay 9789 +/- 0
ptp4l[4333.360]: rms 139 max 195 freq +7310 +/- 90 delay 9799 +/- 9
ptp4l[4335.354]: rms 199 max 218 freq +7033 +/- 12 delay 9820 +/- 0
ptp4l[4337.354]: rms 284 max 391 freq +7400 +/- 164 delay 9801 +/- 5
ptp4l[4339.357]: rms 29 max 39 freq +7318 +/- 15 delay 9798 +/- 0
ptp4l[4341.354]: rms 204 max 253 freq +7071 +/- 19 delay 9798 +/- 0
Code: Select all
sudo ptp4l -i eno2 -m --summary_interval 1These above snips align with the findings here: https://doi.org/10.1016/j.measen.2024.101469ccb056@tick:~$ sudo ptp4l -i eno2 -m --summary_interval 1
ptp4l[5614.149]: selected /dev/ptp0 as PTP clock
ptp4l[5614.151]: port 1 (eno2): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[5614.151]: port 0 (/var/run/ptp4l): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[5614.151]: port 0 (/var/run/ptp4lro): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[5614.596]: port 1 (eno2): new foreign master 2ccf67.fffe.dc63ab-1
ptp4l[5618.596]: selected best master clock 2ccf67.fffe.dc63ab
ptp4l[5618.596]: port 1 (eno2): LISTENING to UNCALIBRATED on RS_SLAVE
ptp4l[5622.392]: rms 647 max 675 freq +5562 +/- 29 delay 2701 +/- 11
ptp4l[5622.392]: port 1 (eno2): UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
ptp4l[5624.392]: rms 564 max 798 freq +6102 +/- 287 delay 2688 +/- 6
ptp4l[5626.392]: rms 301 max 327 freq +5477 +/- 22 delay 2700 +/- 6
ptp4l[5628.392]: rms 89 max 114 freq +5554 +/- 38 delay 2699 +/- 0
ptp4l[5630.392]: rms 25 max 34 freq +5579 +/- 17 delay 2694 +/- 0
ptp4l[5632.392]: rms 55 max 74 freq +5536 +/- 29 delay 2694 +/- 2
ptp4l[5634.392]: rms 64 max 71 freq +5560 +/- 55 delay 2691 +/- 4
ptp4l[5636.392]: rms 57 max 76 freq +5610 +/- 29 delay 2686 +/- 0
ptp4l[5638.398]: rms 76 max 84 freq +5606 +/- 63 delay 2688 +/- 2
ptp4l[5640.392]: rms 2 max 3 freq +5589 +/- 2 delay 2686 +/- 0
ptp4l[5642.392]: rms 36 max 47 freq +5550 +/- 7 delay 2686 +/- 2
ptp4l[5644.392]: rms 60 max 82 freq +5543 +/- 48 delay 2683 +/- 4
ptp4l[5646.392]: rms 30 max 40 freq +5582 +/- 15 delay 2682 +/- 0
ptp4l[5648.393]: rms 19 max 26 freq +5584 +/- 12 delay 2685 +/- 4
ptp4l[5650.393]: rms 56 max 56 freq +5569 +/- 47 delay 2696 +/- 0
ptp4l[5652.393]: rms 50 max 70 freq +5535 +/- 28 delay 2705 +/- 0
ptp4l[5654.392]: rms 74 max 104 freq +5631 +/- 31 delay 2689 +/- 0
ptp4l[5656.393]: rms 109 max 153 freq +5506 +/- 71 delay 2706 +/- 11
ptp4l[5658.393]: rms 33 max 44 freq +5578 +/- 8 delay 2690 +/- 10
ptp4l[5660.392]: rms 70 max 99 freq +5621 +/- 38 delay 2678 +/- 0
ptp4l[5662.393]: rms 65 max 82 freq +5513 +/- 7 delay 2699 +/- 0
ptp4l[5664.393]: rms 89 max 120 freq +5635 +/- 47 delay 2680 +/- 15
ptp4l[5666.393]: rms 79 max 111 freq +5538 +/- 54 delay 2665 +/- 0
ptp4l[5668.397]: rms 94 max 131 freq +5613 +/- 74 delay 2665 +/- 0
ptp4l[5670.393]: rms 10 max 13 freq +5600 +/- 8 delay 2678 +/- 0
ptp4l[5672.393]: rms 88 max 105 freq +5495 +/- 3 delay 2668 +/- 4
ptp4l[5674.393]: rms 90 max 117 freq +5572 +/- 76 delay 2662 +/- 0
ptp4l[5676.393]: rms 68 max 96 freq +5624 +/- 38 delay 2676 +/- 0
ptp4l[5678.393]: rms 86 max 95 freq +5494 +/- 21 delay 2676 +/- 0
ptp4l[5680.393]: rms 95 max 134 freq +5621 +/- 53 delay 2692 +/- 0
ptp4l[5682.393]: rms 68 max 95 freq +5523 +/- 41 delay 2702 +/- 0
ptp4l[5684.393]: rms 82 max 111 freq +5586 +/- 68 delay 2704 +/- 0
ptp4l[5686.393]: rms 57 max 80 freq +5537 +/- 41 delay 2703 +/- 1
Of the devices tested, the I210 showed the most robust performance, maintaining stable clock offsets and low path delays even in high-traffic environments. In contrast, the I219 showed significant variability in moderate traffic conditions, limiting its suitability for critical synchronisation tasks.
Code: Select all
sudo vi /etc/systemd/system/ptp4l-eno1.serviceCode: Select all
[Unit]
Description=Precision Time Protocol (PTP) service (Client)
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/sbin/ptp4l -i eno1 -m --summary_interval 3 --clientOnly 1 --ptp_minor_version 0
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
Code: Select all
sudo vi /etc/systemd/system/ptp4l-eno2.serviceCode: Select all
[Unit]
Description=Precision Time Protocol (PTP) service (Client)
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/sbin/ptp4l -i eno2 -m --summary_interval 3 --clientOnly 1 --ptp_minor_version 0
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
Ref: https://satpulse.net/setup/ptp4l.html
Code: Select all
sudo systemctl daemon-reload
sudo systemctl enable ptp4l-eno1.service
sudo systemctl enable ptp4l-eno2.service
sudo systemctl start ptp4l-eno1
sudo systemctl start ptp4l-eno2
# Check status
sudo systemctl status ptp4l-eno1
sudo systemctl status ptp4l-eno2
Code: Select all
sudo vi /etc/default/gpsdCode: Select all
DEVICES="/dev/ttyS0 /dev/ttyS1 /dev/ttyS2 /dev/ttyS3"
GPSD_OPTIONS="-n -s 115200 -f 8N1"
Code: Select all
sudo systemctl enable /lib/systemd/system/gpsd.service
Code: Select all
sudo vi /etc/chrony/chrony.conf
Code: Select all
refclock PHC /dev/ptp0 tai
refclock PHC /dev/ptp1 tai
refclock SOCK /var/run/chrony.ttyS0.sock refid GPS1
refclock SOCK /var/run/chrony.ttyS1.sock refid GPS2
refclock SOCK /var/run/chrony.ttyS2.sock refid GPS3
refclock SOCK /var/run/chrony.ttyS3.sock refid GPS4
Code: Select all
sudo systemctl restart chronyCode: Select all
while true; do clear; chronyc sources; echo "" ;chronyc sourcestats ; echo ""; chronyc tracking; sleep 1; doneCode: Select all
gpsmon -n localhost:2947:/dev/ttyS0
gpsmon -n localhost:2947:/dev/ttyS1
gpsmon -n localhost:2947:/dev/ttyS2
gpsmon -n localhost:2947:/dev/ttyS3
cgps -s localhost:2947:/dev/ttyS0
cgps -s localhost:2947:/dev/ttyS1
cgps -s localhost:2947:/dev/ttyS2
cgps -s localhost:2947:/dev/ttyS3
Code: Select all
ppscheck /dev/pps1
ppstest /dev/pps1
ntpshmmon -o