Jetson/FAQ/BSP/PTP Synchronization

From eLinux.org
Jump to: navigation, search

Below steps show how to do PTP synchronization between two Jetson devices.

Steps

1. Prepare two Jetson devices, 1 master DUT 1 slave DUT

2. Install ptp package on both DUTs

sudo apt update
sudo apt install linuxptp

3. Run below commands to disable default ptp service on both DUTs

systemctl stop ptp4l
systemctl disable ptp4l
systemctl reboot

4. Assign static IP to both DUTs

5. Connect two DUTs directly with cable. Make sure two DUTs can ping each other

6. Disable time/date sync using below command on both DUTs

sudo timedatectl set-ntp 0

7. Run below command on slave DUT to set a different timestamp

sudo date 040403312012

8. Run below command on both DUTs

sudo ifconfig eth0 allmulti promisc

9. Run below command on master DUT with gPTP.cfg (run in different terminal)

sudo ptp4l -i eth0 -m -f gPTP.cfg  # start ptp daemon
sudo phc2sys -w -s eth0 -O 0  # sync system time with ptp

10. Run below commands on slave DUT gPTP.cfg (run in different terminal)

sudo ptp4l -i eth0 -m -s -f gPTP.cfg  # start ptp daemon
sudo phc2sys -w -s eth0 -O 0  # sync system time with ptp

Then you can see slave's system time is synced with master

gPTP.cfg:

[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	1000
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
#
[eth0]
transportSpecific	0x1
[global]
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