APEX ORIN NX II PTP Function#

Overview#

The Precision Time Protocol (PTP) synchronizes clocks across a computer network. On a local area network, it can achieve nanosecond-level clock accuracy.

Preparation#

Preparation: Hardware Connections#

Prepare two devices, Device A and Device B. Device A is the master and Device B is the slave. Assign static IP addresses to their Ethernet interfaces, connect them directly with an Ethernet cable, and confirm that they can ping each other. If the network link includes a switch or router, the switch or router must also support PTP.

Preparation: Software Environment#

sudo git clone -b v4.1 git://git.code.sf.net/p/linuxptp/code linuxptp
cd linuxptp
sudo make
sudo make install

Master and Slave Configuration#

Configuration Procedure

  • Start ptp4l on the master → Synchronize the master system time to its Ethernet hardware clock → Synchronize the master time to the slave Ethernet hardware clock → Synchronize the slave Ethernet hardware clock to its system clock

Open a terminal and run the following command:

sudo ptp4l -i eth1 -m -H --step_threshold 1.0

This command starts ptp4l. The master terminal should display output similar to the following:

Open another terminal and run the following command:

sudo phc2sys -m -s CLOCK_REALTIME -c eth1 -w --step_threshold 1.0

This command synchronizes the master system clock to its Ethernet hardware clock. The terminal should display output similar to the following:

Open a terminal on the device and run the following command:

sudo ptp4l -i eth1 -m -H -s --step_threshold 1.0

This command synchronizes the master clock to the slave clock. The terminal should display output similar to the following:

master offset is the time offset between the master and slave devices, in ns.

Open another terminal and run the following command:

sudo phc2sys -m -s eth1 -w --step_threshold 1.0

This command synchronizes the slave Ethernet hardware clock to its system clock. The terminal should display output similar to the following:

phc offset is the time offset between the Ethernet hardware clock and system clock on the slave device.

Functional Verification#

Test Procedure

  • Check the master time → Check the slave time → Change the master time → Confirm that the slave time is synchronized

Check the master system time:

sudo timedatectl

Check the slave system time:

sudo timedatectl

Change the Master System Time

sudo date -s 12:12:12

The master system time has now changed, as shown below:

Monitor the slave system time at the same time. After approximately 30 seconds, it should change to the master system time.

sudo timedatectl

The slave system time should now match the master system time, as shown below:

Performance Verification#

Open a terminal on the slave device and run the following command:

sudo ptp4l -i eth1 -m -H -s --step_threshold 1.0

This command synchronizes the master clock to the slave clock. The terminal should display output similar to the following:

master offset is the time offset between the master and slave devices, in ns.

Notes#

Check for Hardware PTP Support#

sudo ethtool -T ethX

Replace ethX with the appropriate Ethernet interface. The following output uses eth1 as an example:

If the output includes the following parameters, the device supports hardware PTP: SOF_TIMESTAMPING_SOFTWARE

SOF_TIMESTAMPING_TX_SOFTWARE

SOF_TIMESTAMPING_RX_SOFTWARE

SOF_TIMESTAMPING_RAW_HARDWARE

SOF_TIMESTAMPING_TX_HARDWARE

SOF_TIMESTAMPING_RX_HARDWARE

If the output includes only the following parameters, the device does not support hardware PTP.

SOF_TIMESTAMPING_SOFTWARE

SOF_TIMESTAMPING_TX_SOFTWARE

SOF_TIMESTAMPING_RX_SOFTWARE

PTP Troubleshooting#

​#

Symptom: PTP time synchronization between a MIIVII device running ptpd and an external device fails#

Check 1: Hardware Connections#

Step 1: Check the Ethernet Cable#

Connect the Ethernet cable to another device that can act as a PTP master.

  • If the external device connects and synchronizes successfully, the cable and the device receiving time synchronization are working. Continue with “Check 2: Network Connectivity”.

  • If the external device cannot connect or synchronize, replace the Ethernet cable and check the device receiving time synchronization.

Step 2: Check Whether the Switch Supports PTP#

If the network contains a switch, consult its manual or manufacturer to confirm that it supports PTP.

  • If the switch supports PTP, continue with “Check 2: Network Connectivity”.

  • If the switch does not support PTP, replace or remove it and try again.

Check 2: Network Connectivity#

Step 1: Check Network Communication Between the MIIVII Device and External Device#

  1. Check that the MIIVII device and external device are on the same subnet.

  2. Use ping to check whether the MIIVII device and external device can communicate with each other.

  • If they cannot ping each other, change the IP settings until they can.

If they can ping each other, continue with “Check 3: System Time Synchronization Service”.

Step 2: Check for Multicast Filtering#

Ensure that the network allows multicast messages, which are required for PTP operation. Some network configurations may block multicast traffic.

Check 3: System Time Synchronization Service#

Step 1: Check Whether ptp4l Is Installed Correctly#

Check whether the

 package is installed and its 

service is running.

Run the following command to check the service status: sudo systemctl status ptp4l.service

  • If the service is unavailable, install ptp4l manually (sudo apt-get install linuxptp), then run (sudo ptp4l -i <interface_name> -m) and verify again.

  • If the service exists and is running normally, continue with “Check 4: Log Errors”.

Check 4: Log Errors#

Step 1: Export the ptp4l Service Logs#

The logs are usually available in /var/log/syslog and can be retrieved with journalctl -u ptp4l.service. Upload them to the support ticket for MIIVII Technical Support.