Synchronizing System Clocks with SentiBoard 2.0
Accurate timekeeping is crucial for many applications, including distributed data processing systems and autonomous robots. In the realm of Linux systems, precise time synchronization is achieved through various protocols, with the Precision Time Protocol (PTP) being one of the most advanced. In this blog post, we will explore how to synchronize Linux system clocks with SentiBoard 2.0 acting as a PTP Grandmaster.
Understanding Precision Time Protocol (PTP)
PTP, defined in the IEEE 1588 standard, is designed to achieve sub-microsecond accuracy in clock synchronization over Ethernet networks. It operates in a master-slave architecture, with the Grandmaster clock providing the reference time to the slave clocks.
It is important to emphasize that using the PTP protocol, we are able to synchronize the PTP Hardware Clocks. PTP Hardware Clocks are the clocks located on the Network Interface Card (NIC) / Ethernet controller of your network nodes. Your system will likely also have its own Real Time Clock / system clock, which runs decoupled from the system's PTP Hardware Clock. Hence, in order for your Linux platform's system time to be synchronized with your network's (synchronized) PHCs, your Linux platform needs to synchronize its own Real Time Clock with its own PHC.
In most Linux based systems you will be able to run a collection of software usually found under the umbrella name linuxptp. This collection includes the most critical components for the demonstrator setup described in this blog post, namely:
- ptp4l: daemon that synchronizes the PTP Hardware Clock (PHC) on the NIC / Ethernet controller.
- phc2sys: daemon that synchronizes the PHC and the System clock;
These two software packages and how they work together can be summarized in the following Figure
Our SentiBoard 2.0 GrandMaster Demonstrator Setup
In order to demonstrate the accuracy and precision of PTP synchronization with SentiBoard 2.0 in the loop, we have deployed a SentiBoard 2.0 as PTP GrandMaster in conjunction with 1 network switch, and a BeagleBone Black (BBB) embedded Linux platform.
This blog post does not cover the installation, setup and configuration of the SentiBoard 2.0 and the BBB, but when replicating such a setup it is important to make sure that
- Your NIC supports hardware timestamping of both transmitted and received data. It is possible to run ptp4l using software timestamping of ethernet packets, but this will (greatly) affect the performance of the synchronization process.
- Your linux kernel is configured so that it exposes the PHC on an operating system level.
- (Optional for increased accuracy and precision): The kernel has been patched with Real-Time capabilities, for instance with the SMP PREEMPT patch. You can read more here, but in short, this means the system clock <-> PHC synchronization will be more deterministic in run-time, decreasing the jitter when synchronizing the two clocks.
If you need help getting your system ready for PTP synchronization, we do supply How-To guides and consultations on the topic to our customers.
Note that the SentiBoard 2.0 can be used with our SentiConnect modules, such as the Dual GNSS Receiver, in order to make the SentiBoard 2.0's PHC synchronize to GNSS time. This is not mandatory, but effectively creates a GNSS disciplined GrandMaster clock for your network, removing local drift over time of the GrandMaster clock.
Performance Results
Using the SentiBoard 2.0's default PTPv2 End-to-End profile as a GrandMaster, the BBB's ptp4l in slave mode, and phc2sys to synchronize the BBB's PHC to its system clock, we observed the following results:
We see that the BBB's PHC reports being synchronized with the SentiBoard 2.0's PHC with a mean of 2.1 nanoseconds, and a standard deviation of 22.4 nanoseconds. Further, the BBB's System Time reports to synchronize with the BBB's PHC with a mean of 1.85 nanoseconds, and a standard deviation of 25.1 nanoseconds.
Hence, according to the law of additive normal distributions, we can infer that the BBB's System Clock synchronizes to the SentiBoard 2.0's PHC with a mean of 3.95 nanoseconds, and a standard deviation of 33.64 nanoseconds. This yields a 95% confidence of the BBB's System Clock being synchronized to the SentiBoard 2.0's GrandMaster clock within the range of -100 to +100 nanoseconds.
Note that the performance of the synchronization will be affected by external parameteres such as the BBB's system load, the type and number of network switches used, and the amount of network traffic currently going through your network.
Conclusion:
Synchronizing Linux system clocks with SentiBoard 2.0 as a PTP Grandmaster ensures precise timekeeping in your network. The combination of Linux's PTP support and SentiBoard 2.0's capabilities creates a robust and accurate time synchronization solution for demanding applications. Consider integrating this setup into your network infrastructure to experience the benefits of sub-microsecond clock accuracy.