Time not synchronized between two nx devices with ptp

Hi ,
I am using PTP synchronize time between tow xavier nx device (with one xavier NX device as master and another xavier nx device as slave) . I took the refernce commands from the
forum ( Time sensitive networking [TSN] on NX - #10 by carolyuu )
Master side
ifconfig eth0 down
ifconfig eth0 up
ifconfig eth0 0.0.0.0
ip addr add 10.0.0.1/24 dev eth0
ip link set dev eth0 up
timedatectl set-ntp false
date 010100002018
phc_ctl /dev/ptp0 set
phc_ctl /dev/ptp0 get
ptp4l -f gPTP.cfg -i eth0 -p /dev/ptp0 -m

slave side
ifconfig eth0 down
ifconfig eth0 up
ifconfig eth0 0.0.0.0
ip addr add 10.0.0.2/24 dev eth0
ip link set dev eth0 up
timedatectl set-ntp false
phc_ctl /dev/ptp0 get
ptp4l -f gPTP.cfg -i eth0 -p /dev/ptp0 -s -m

I have checked the time using both “date” command and “phc_ctl /dev/ptp0 get” command.The date and time I sent in the master device is not reflected in the slave device.

Any help is appreciated

hello tegra_user,

could you please try again to execute below commands on both of your master/slave device.
for example,

$ systemctl stop ptp4l
$ systemctl disable ptp4l
$ systemctl reboot

Hi @JerryChang ,
I tried executing these commands in both master and slave ,and then I tried the commands I mentioned above. But still I am not able to synchronize the slave clock to master clock.

hello tegra_user,

may I know what’s JetPack release version of your master and slave devices?
you may check release tag, $ cat /etc/nv_tegra_release for reference,
thanks

what is in the file gPTP.cfg ?

Hi Andrey,
I have taken the gPTP.cfg from the link I specified above( Time sensitive networking [TSN] on NX - #10 by carolyuu ).

[global]

Default Data Set

twoStepFlag 1
gmCapable 1
priority1 248
priority2 248
domainNumber 0
clockClass 248
clockAccuracy 0xFE
offsetScaledLogVariance 0xFFFF
free_running 0
freq_est_interval 1

Port Data Set

logAnnounceInterval 1
logSyncInterval -3
logMinPdelayReqInterval 0
announceReceiptTimeout 3
syncReceiptTimeout 3
delayAsymmetry 0
fault_reset_interval 4
neighborPropDelayThresh 800
min_neighbor_prop_delay -20000000

Run time options

assume_two_step 1
logging_level 6
path_trace_enabled 1
follow_up_info 1
hybrid_e2e 0
tx_timestamp_timeout 1
use_syslog 1
verbose 0
summary_interval 0
kernel_leap 1
check_fup_sync 0

Servo options

pi_proportional_const 0.0
pi_integral_const 0.0
pi_proportional_scale 0.0
pi_proportional_exponent -0.3
pi_proportional_norm_max 0.7
pi_integral_scale 0.0
pi_integral_exponent 0.4
pi_integral_norm_max 0.3
step_threshold 0.0
first_step_threshold 0.00002
max_frequency 900000000
clock_servo pi
sanity_freq_limit 200000000
ntpshm_segment 0

Transport options

transportSpecific 0x1
ptp_dst_mac 01:80:C2:00:00:0E
p2p_dst_mac 01:80:C2:00:00:0E
uds_address /var/run/ptp4l

Default interface options

network_transport L2
delay_mechanism P2P
time_stamping hardware
tsproc_mode filter
delay_filter moving_median
delay_filter_length 10
egressLatency 0
ingressLatency 0
boundary_clock_jbod 0

Hi @JerryChang , We are using 32.5.1 SD card image downloaded from jetson download centre.

R32 (release), REVISION: 5.1, GCID: 26202423, BOARD: t186ref, EABI: aarch64, DATE: Fri Feb 19 16:50:29 UTC 2021

do you connect two devices by direct copper wire cable?

Hi @Andrey1984 ,
I connect two devices with a ethernet cable .
Where should I connect the copper wire cable?

this should work for you

Host side
ifconfig eth0 down
ifconfig eth0 up
ifconfig eth0 0.0.0.0
ip addr add 10.0.0.1/24 dev eth0
ip link set dev eth0 up
timedatectl set-ntp false
date 010100002018
phc_ctl /dev/ptp0 set
phc_ctl /dev/ptp0 get
ptp4l -f gPTP.cfg -i eth0 -p /dev/ptp0 -m

DUT side
ifconfig eth0 down
ifconfig eth0 up
ifconfig eth0 0.0.0.0
ip addr add 10.0.0.2/24 dev eth0
ip link set dev eth0 up
timedatectl set-ntp false
phc_ctl /dev/ptp0 get
ptp4l -f gPTP.cfg -i eth0 -p /dev/ptp0 -s -m

what is the output of phc_ctl /dev/ptp0 get at the client side?

Hi @Andrey1984 ,
I have tried the above commands, but I coudn’t get the time synchronized on my slave device.The below is is the phc_ctl /dev/ptp0 output on my device.

phc_ctl[235.617]:
capabilities:
62500000 maximum frequency adjustment (ppb)
0 programable alarms
0 external time stamp channels
0 programmable periodic signals
doesn’t have pulse per second support

the command should be exactly

phc_ctl /dev/ptp0 get

with the get at the end

Hi @Andrey1984 ,
Sorry I missed out the get .I have added the result for the command below.

$ sudo phc_ctl /dev/ptp0 get
phc_ctl[255.518]: clock time is 1625919201.249458848 or Sat Jul 10 17:43:21 2021

yes but you would have to execute the whole thing again

Host side
ifconfig eth0 down
ifconfig eth0 up
ifconfig eth0 0.0.0.0
ip addr add 10.0.0.1/24 dev eth0
ip link set dev eth0 up
timedatectl set-ntp false
date 010100002018
phc_ctl /dev/ptp0 set
phc_ctl /dev/ptp0 get
ptp4l -f gPTP.cfg -i eth0 -p /dev/ptp0 -m

DUT side
ifconfig eth0 down
ifconfig eth0 up
ifconfig eth0 0.0.0.0
ip addr add 10.0.0.2/24 dev eth0
ip link set dev eth0 up
timedatectl set-ntp false
phc_ctl /dev/ptp0 get
ptp4l -f gPTP.cfg -i eth0 -p /dev/ptp0 -s -m

execute both sides from root user, not sudo
are both devices jetson NX’es?
also you may paste both outputs of executing of

ethtool -T eth0

for linuxptp I would use

 git clone git://git.code.sf.net/p/linuxptp/code linuxptp
   cd linuxptp/
   make -j6
  sudo make install

Hi @Andrey1984 ,
I have tried using the linuxptp command from the site you have specified, but couldn’t find any improvements.
Also I have pasted below teh output of ethtool -T eth0.

Time stamping parameters for eth0:
Capabilities:
hardware-transmit (SOF_TIMESTAMPING_TX_HARDWARE)
software-transmit (SOF_TIMESTAMPING_TX_SOFTWARE)
hardware-receive (SOF_TIMESTAMPING_RX_HARDWARE)
software-receive (SOF_TIMESTAMPING_RX_SOFTWARE)
software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
hardware-raw-clock (SOF_TIMESTAMPING_RAW_HARDWARE)
PTP Hardware Clock: 0
Hardware Transmit Timestamp Modes:
off (HWTSTAMP_TX_OFF)
on (HWTSTAMP_TX_ON)
Hardware Receive Filter Modes:
none (HWTSTAMP_FILTER_NONE)
ptpv1-l4-sync (HWTSTAMP_FILTER_PTP_V1_L4_SYNC)
ptpv1-l4-delay-req (HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ)
ptpv2-l4-sync (HWTSTAMP_FILTER_PTP_V2_L4_SYNC)
ptpv2-l4-delay-req (HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ)
ptpv2-l2-sync (HWTSTAMP_FILTER_PTP_V2_L2_SYNC)
ptpv2-l2-delay-req (HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ)
ptpv2-event (HWTSTAMP_FILTER_PTP_V2_EVENT)

phc_ctl /dev/ptp0 get
should return the host device time at the client side if you repeat steps from root user

Hi @Andrey1984 ,
I have run the commands from the root terminal, but “phc_ctl /dev/ptp0 get” on client side doesn’t return the time on the host side.
Where as I am able to get the host device side time on client side when I run the ptpd command specified by you on this link ( Implementation of Precise Time Synchronization between two Xaviers over WLAN )

Host side:
sudo ptpd -M -V -i eth0
Device side:
sudo ptpd -s -V -i eth0

I wonder , why does the ptp4l command doesn’t work for me.

ptpd and linux ptp [ptp4l] are two differnt projects
also what is the output of ethtool -T eth0 at the second device?

Hi @Andrey1984 ,
Do you have any suggestions why running the above commands(host and device side commands for ptp4l) doesn’t work for me ?