1. IntroductionIn many industrial automation, power grid, and telecommunications applications, standard NTP (Network Time Protocol) is insufficient because it only offers millisecond-level accuracy. IEEE 1588, also known as the Precision Time Protocol (PTP), provides a solution by using hardware timestamping to achieve microsecond or even nanosecond-level synchronization across a local area network.
While IEEE 1588V1 was the original standard, IEEE 1588V2 (PTPv2) improved precision and reduced network overhead. The Nuvoton NUC980 series features built-in hardware support for PTP, making it an excellent choice for time-sensitive networking tasks.
2. Buildroot and Kernel ConfigurationTo enable PTP support, you must configure both the Linux kernel (to interface with the hardware clock) and the Buildroot target packages (to provide the user-space tools).
Step A: Linux Kernel SettingsNavigate to your kernel configuration: $ make linux-menuconfig
Enable the following paths to ensure the driver generates the /dev/ptp0 interface:
Step B: Buildroot Tool SelectionNavigate to your Buildroot configuration: $ make menuconfig
Select the necessary networking utilities:
Run make to build the images.
3. Hardware SetupConnect two NUC980 boards directly using an Ethernet cable.
Important: Ensure that both boards have unique MAC addresses. You can set this in your bootloader (U-Boot) or via the ifconfig command before starting the PTP service to avoid network conflicts.
4. Step-by-Step SynchronizationBoard A: The Grand MasterBoard A will act as the reference time source for the network. We will run ptp4l using the Layer-2 Ethernet transport (-2).
# ptp4l -i eth0 -2 -m
Board B: The Client (Slave)Board B will synchronize its Hardware Clock to Board A.
# ptp4l -i eth0 -2 -s -m
Step 5: Synchronizing the System ClockBy default, ptp4l only synchronizes the PTP Hardware Clock (PHC) on the Ethernet chip. To update the actual Linux system time (the clock you see when typing date), you must use phc2sys to bridge the two.
Run ptp4l in the background, then execute:
# ptp4l -i eth0 -2 -s &# phc2sys -s /dev/ptp0 -c CLOCK_REALTIME -w -m -R 0.2
-s /dev/ptp0: Defines the source (the hardware clock).
-c CLOCK_REALTIME: Defines the destination (the Linux system clock).
-w: Waits for ptp4l to be synchronized before starting.
-R 0.2: (Optional) Sets the update rate to 0.2 Hz, meaning the system clock will update once every 5 seconds. Default is 1 Hz.
-m: (Optional) Remove this to disable console output once you verify it is working.
ConclusionBy leveraging the NUC980’s hardware timestamping and the linuxptp stack, you can achieve highly accurate synchronization with very little CPU overhead. This setup ensures that your distributed logs, sensor data, and control signals remain perfectly aligned across your network.