Synchronize PTP Time (IEEE 802.1AS)#
What is PTP?#
Precision Time Protocol (PTP) provides sub-microsecond time synchronization across Ethernet devices, enabling accurate latency measurements.
Install PTP Tools#
sudo apt-get update
sudo apt-get install -y linuxptp git
git clone https://git.code.sf.net/p/linuxptp/code linuxptp
cd linuxptp
PTP Commands#
The TSN switch is configured to act as the PTP Grandmaster clock. On each Arrow Lake machine, execute the following command to synchronize the system clock using PTP.
Note: Make sure to replace
enp1s0with the actual network interface name associated with thei226network card.
Start the PTP daemon (
ptp4l).Start the
ptp4ldaemon on each machine, specifying the network interface (enp1s0) related to the i226 network on that machine and the gPTP configuration file.sudo ptp4l -i enp1s0 -f configs/gPTP.cfg --step_threshold=1 -m -s
Synchronize the System Clock (
phc2sys).Synchronize the system clock with the PTP hardware clock (PHC).
sudo phc2sys -s enp1s0 -c CLOCK_REALTIME --step_threshold=1 --transportSpecific=1 -w -m
Verify Synchronization.
Check the
phc2sysoutput to ensure the offset is within acceptable limits (e.g., less than 50ns). The output should look similar to this:phc2sys[1234.567]: CLOCK_REALTIME phc offset 12345 s0 freq +0 delay 1234