I should mention this is just using the default config file installed with
ptp4l, but for full disclosure:

nvidia@jetson-randy2:~$ cat /etc/linuxptp/ptp4l.conf
[global]
#
# Default Data Set
#
twoStepFlag             1
slaveOnly               0
priority1               128
priority2               128
domainNumber            0
clockClass              248
clockAccuracy           0xFE
offsetScaledLogVariance 0xFFFF
free_running            0
freq_est_interval       1
#
# Port Data Set
#
logAnnounceInterval     1
logSyncInterval         0
logMinDelayReqInterval  0
logMinPdelayReqInterval 0
announceReceiptTimeout  3
syncReceiptTimeout      0
delayAsymmetry          0
fault_reset_interval    4
neighborPropDelayThresh 20000000
#
# Run time options
#
assume_two_step         0
logging_level           6
path_trace_enabled      0
follow_up_info          0
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       0x0
ptp_dst_mac             01:1B:19:00:00:00
p2p_dst_mac             01:80:C2:00:00:0E
udp_ttl                 1
udp6_scope              0x0E
uds_address             /var/run/ptp4l
#
# Default interface options
#
network_transport       UDPv4
delay_mechanism         E2E
time_stamping           hardware
tsproc_mode             filter
delay_filter            moving_median
delay_filter_length     10
egressLatency           0
ingressLatency          0
boundary_clock_jbod     0
#
# Clock description
#
productDescription      ;;
revisionData            ;;
manufacturerIdentity    00:00:00
userDescription         ;
timeSource              0xA0


On Fri, Dec 21, 2018 at 12:12 PM Randy Spruyt <randy.spr...@gmail.com>
wrote:

> Perhaps an elementary question, but maybe someone knows. The goal is to
> have getnstimeofday() return a synchronized time value for 2 systems in a
> kernel module. To do this, I would expect a simple "date" call from each
> system to be pretty close, but it is not.
>
>
> Using 2 x Jetson TX2 boards running Ubuntu 16.04 + ptp4l on Device 1 we
> set an arbitrary date.
>
> ptp4l is running as a service on both:
>  /usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i eth0
>
>
> set an arbitrary date on Device1:
>
>
> nvidia@jetson-randy1:~$ sudo date -s "Dec 1 2015 04:00:00"
> Tue Dec  1 04:00:00 UTC 2015
>
> nvidia@jetson-randy1:~$ timedatectl
>       Local time: Tue 2015-12-01 04:00:01 UTC
>   Universal time: Tue 2015-12-01 04:00:01 UTC
>         RTC time: Wed 2017-03-01 12:12:00
>        Time zone: Etc/UTC (UTC, +0000)
>  Network time on: no
> NTP synchronized: no
>  RTC in local TZ: no
>
>
> on Device2 we set a different arbitrary date:
>
> nvidia@jetson-randy2:~$ sudo date -s "Mar 10 2018 12:00:00"
> Sat Mar 10 12:00:00 UTC 2018
>
> nvidia@jetson-randy2:~$ timedatectl
>       Local time: Sat 2018-03-10 12:00:01 UTC
>   Universal time: Sat 2018-03-10 12:00:01 UTC
>         RTC time: Sat 2018-12-01 13:11:21
>        Time zone: Etc/UTC (UTC, +0000)
>  Network time on: no
> NTP synchronized: no
>  RTC in local TZ: no
>
>
> Now we start ptp4l and phc2sys on each device.
>
> Device 1:
>
> Dec  1 04:02:06 jetson-randy1 systemd[1]: Started Precision Time Protocol
> (PTP) service.
> Dec  1 04:02:06 jetson-randy1 ptp4l: [83945.116] selected /dev/ptp0 as PTP
> clock
> Dec  1 04:02:06 jetson-randy1 ptp4l: [83945.117] port 1: INITIALIZING to
> LISTENING on INITIALIZE
> Dec  1 04:02:06 jetson-randy1 ptp4l: [83945.117] port 0: INITIALIZING to
> LISTENING on INITIALIZE
> Dec  1 04:02:08 jetson-randy1 ptp4l: [83946.193] port 1: new foreign
> master 00044b.fffe.c56e7b-1
> Dec  1 04:02:12 jetson-randy1 ptp4l: [83950.194] selected best master
> clock 00044b.fffe.c56e7b
> Dec  1 04:02:12 jetson-randy1 ptp4l: [83950.195] assuming the grand master
> role
> Dec  1 04:02:12 jetson-randy1 ptp4l: [83950.195] port 1: LISTENING to
> GRAND_MASTER on RS_GRAND_MASTER
>
> and
>
> nvidia@jetson-randy1:~$ sudo phc2sys -a -r -m
> phc2sys[83977.835]: reconfiguring after port state change
> phc2sys[83977.839]: selecting eth0 for synchronization
> phc2sys[83977.840]: nothing to synchronize
>
>
> Device 2:
>
> Mar 10 12:03:02 jetson-randy2 systemd[1]: Started Precision Time Protocol
> (PTP) service.
> Mar 10 12:03:02 jetson-randy2 ptp4l: [75310.117] selected /dev/ptp0 as PTP
> clock
> Mar 10 12:03:02 jetson-randy2 ptp4l: [75310.118] port 1: INITIALIZING to
> LISTENING on INITIALIZE
> Mar 10 12:03:02 jetson-randy2 ptp4l: [75310.118] port 0: INITIALIZING to
> LISTENING on INITIALIZE
> Mar 10 12:03:04 jetson-randy2 ptp4l: [75312.065] port 1: new foreign
> master 00044b.fffe.c4cf6f-1
> Mar 10 12:03:08 jetson-randy2 ptp4l: [75316.066] selected best master
> clock 00044b.fffe.c4cf6f
> Mar 10 12:03:08 jetson-randy2 ptp4l: [75316.067] port 1: LISTENING to
> UNCALIBRATED on RS_SLAVE
> Mar 10 12:03:09 jetson-randy2 ptp4l: [75317.066] master offset
> 71740766475479566 s0 freq +62500000 path delay         0
> Mar 10 12:03:10 jetson-randy2 ptp4l: [75318.066] master offset
> 71740766475512626 s1 freq +62500000 path delay     -4004
> Mar 10 12:03:12 jetson-randy2 ptp4l: [75320.068] master offset -124949356
> s2 freq -62449356 path delay     -1768
> Mar 10 12:03:12 jetson-randy2 ptp4l: [75320.068] port 1: UNCALIBRATED to
> SLAVE on MASTER_CLOCK_SELECTED
> Mar 10 12:03:13 jetson-randy2 ptp4l: [75321.067] master offset  -62730032
> s2 freq -37714839 path delay     -4004
> Mar 10 12:03:14 jetson-randy2 ptp4l: [75322.068] master offset  -24937060
> s2 freq -18740876 path delay     -6240
> Mar 10 12:03:15 jetson-randy2 ptp4l: [75323.067] master offset   -1649428
> s2 freq -2934362 path delay  -4492000
>
> and
>
> nvidia@jetson-randy2:~$ sudo phc2sys -a -r -m
> phc2sys[75361.130]: reconfiguring after port state change
> phc2sys[75361.133]: selecting CLOCK_REALTIME for synchronization
> phc2sys[75361.133]: selecting eth0 as the master clock
> phc2sys[75361.133]: CLOCK_REALTIME phc offset 71740802475284240 s0 freq
> +30393 delay   5600
> phc2sys[75362.134]: CLOCK_REALTIME phc offset 71740802475284367 s1 freq
> +30520 delay   5664
> phc2sys[75363.134]: CLOCK_REALTIME phc offset      -400 s2 freq  +30120
> delay   3136
> phc2sys[75364.135]: CLOCK_REALTIME phc offset        17 s2 freq  +30417
> delay   3168
> phc2sys[75365.135]: CLOCK_REALTIME phc offset       502 s2 freq  +30907
> delay   5664
> phc2sys[75366.136]: CLOCK_REALTIME phc offset       100 s2 freq  +30656
> delay   5632
> phc2sys[75367.137]: CLOCK_REALTIME phc offset      -117 s2 freq  +30469
> delay   5664
> phc2sys[75368.137]: CLOCK_REALTIME phc offset      -114 s2 freq  +30437
> delay   5663
> phc2sys[75369.138]: CLOCK_REALTIME phc offset      -174 s2 freq  +30342
> delay   5568
>
> yet if we run these commands quickly:
>
> nvidia@jetson-randy1:~$ date
> Tue Dec  1 04:05:21 UTC 2015
>
> nvidia@jetson-randy2:~$ date
> Tue Dec  1 04:04:45 UTC 2015
>
> we notice that the times are off by about 40 seconds.
>
> Thoughts?
> Randy
>
>
_______________________________________________
Linuxptp-users mailing list
Linuxptp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-users

Reply via email to