Time not synchronized between two nx devices with ptp

Hi @_av ,
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 @_av ,
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 @_av ,
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 @_av ,
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 @_av ,
Do you have any suggestions why running the above commands(host and device side commands for ptp4l) doesn’t work for me ?

are both devices jetson NX’es?
it seems you are missing some gaps
you may try to reflash both units

Yes @_av ,
Both are jetson NX devices.
Let me try reflashing units and try.

Hi @_av ,
I have tried flashing in again and tried , but still didn’t see any improvement.FYI , I am trying in the SD card SOM.

Hi @_av and @JerryChang ,
I use the below commands on 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 -i eth0 -m -H
phc2sys -m -s CLOCK_REALTIME -c eth0 -w

I use the below commands on the 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 -i eth0 -p /dev/ptp0 -s -m
phc2sys -a -r -m

I have attached the logs of the master side and slave side
Master_side_logs (2.2 KB)
slave-side-logs.txt (3.0 KB)

Could someone help me on what I am missing?

Also on what L4T version do you test on your end @_av ? Could you please test on 32.5.1 or any L4T release and check if it the above comands are working for you. ?

what is the output of phc_ctl /dev/ptp0 get at both devices?
do devices reach each other via 10.0.0.0/24 at all?
R U using direct or cross-over cable for direct LAN<–>LAN connection?

hi @_av ,
Master:
phc_ctl[3056.963]: clock time is 1517158150.721299376 or Sun Jan 28 16:49:10 2018
Slave:
phc_ctl[3035.510]: clock time is 1514765673.713599072 or Mon Jan 1 00:14:33 2018

Yes . The devices reach each other via 10.0.0.0/24.But the IP gets resetted on both end randomly.When we set it again manually We are able to ping again

Yes. We are using a direct LAN<->LAN connector.

Hello
as both computers show the year 2018
It appears that you have had a moment when Slave synchronized to the Master
Now what you need, as it appears to me, is to determine exactly the point with combination of your steps that worked for the synchronization,
then you could use it as required

Hi @_av ,
I couldn’t get your point.
Only the years in both the computers are synchronized, but the date and time are not synchronized.How could I get them synchronized,

I just pointed out that synchronization has taken place.
The steps redundant to do it manually one-time are shared above multiple times.
Continious synchronization is a different thing that needs calibrated steps specifically for that matter though

Hi @_av ,
Could you please explain what is continuosu synchronization . We need date and time in seconds level synchronized in both the devices. We have acheived it using ptpd. Could you please tell us how to acheive the continuous time synchronization using ptp4l ?