Discussion:
[Linuxptp-users] phc2sys doesn't sync RTC, UTC - TAI Difference
DSP
2016-06-08 09:19:40 UTC
Permalink
Hi,
can someone please give me a hint to find the correct settings for my problem.

I have a master and two slaves. I use Level2 and E2E mechanism for syncing.

The ptp hardware clock seems to be adjusted correct but with phc2sys i can't
set the RTC on the same value as the PHC. It is 36 seconds away like TAI-UTC.

Here are my calls and the logs:


Master:

ptp4l -2 -i eth0 -p /dev/ptp0 -m

ptp4l[5797.764]: selected /dev/ptp0 as PTP clock
ptp4l[5797.810]: port 1: INITIALIZING to LISTENING on INITIALIZE
ptp4l[5797.817]: port 0: INITIALIZING to LISTENING on INITIALIZE
ptp4l[5804.739]: port 1: LISTENING to MASTER on
ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
ptp4l[5804.743]: selected best master clock 68c90b.fffe.24a105
ptp4l[5804.743]: assuming the grand master role

phc2sys -s eth0 -c CLOCK_REALTIME -w -m

phc2sys[5827.066]: sys offset 35000003040 s0 freq +0 delay 3760
phc2sys[5828.084]: sys offset 35000003048 s1 freq +8 delay 3760
phc2sys[5829.087]: sys offset 1511 s2 freq +1519 delay 3800
phc2sys[5830.088]: sys offset -1915 s2 freq -1454 delay 3800
phc2sys[5831.089]: sys offset 49 s2 freq -64 delay 3760
phc2sys[5832.090]: sys offset -1518 s2 freq -1617 delay 3760
phc2sys[5833.090]: sys offset 3387 s2 freq +2833 delay 3760
phc2sys[5834.091]: sys offset -2822 s2 freq -2360 delay 3760
phc2sys[5835.092]: sys offset 2490 s2 freq +2106 delay 3760
phc2sys[5836.093]: sys offset -3216 s2 freq -2853 delay 3760
phc2sys[5837.093]: sys offset 1816 s2 freq +1214 delay 3800
phc2sys[5838.094]: sys offset -8917 s2 freq -8974 delay 3721
phc2sys[5839.095]: sys offset 14571 s2 freq +11838 delay 3760
phc2sys[5840.095]: sys offset -8496 s2 freq -6857 delay 3761

RTC: Wed Jun 8 10:34:27 2016 0.000000 seconds
PHC: 2016-06-08 10:35:02.316598760

-------------------------------------------------------------------------------
Slave1:

ptp4l -i eth0 -p /dev/ptp0 -f /etc/linuxptp/default.cfg -s -m

ptp4l[5795.940]: selected /dev/ptp0 as PTP clock
ptp4l[5795.976]: port 1: INITIALIZING to LISTENING on INITIALIZE
ptp4l[5795.979]: port 0: INITIALIZING to LISTENING on INITIALIZE
ptp4l[5801.713]: port 1: new foreign master 68c90b.fffe.24a105-1
ptp4l[5802.114]: selected best master clock ec24b8.fffe.be32ce
ptp4l[5805.713]: selected best master clock 68c90b.fffe.24a105
ptp4l[5805.714]: running in a temporal vortex
ptp4l[5805.716]: port 1: LISTENING to UNCALIBRATED on RS_SLAVE
ptp4l[5806.712]: master offset 950644976 s0 freq +0 path delay 0
ptp4l[5807.713]: master offset 950624115 s1 freq -20858 path delay 11577
ptp4l[5809.713]: master offset 22943 s2 freq +2085 path delay 10286
ptp4l[5809.715]: port 1: UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
ptp4l[5810.713]: master offset 9637 s2 freq -4338 path delay 12236
ptp4l[5811.713]: master offset 5655 s2 freq -5429 path delay 11261
ptp4l[5812.713]: master offset 1757 s2 freq -7630 path delay 11261
ptp4l[5813.714]: master offset 1034 s2 freq -7826 path delay 10286
ptp4l[5814.714]: master offset -336 s2 freq -8886 path delay 10202
ptp4l[5815.714]: master offset -656 s2 freq -9307 path delay 10119
ptp4l[5816.714]: master offset 141 s2 freq -8707 path delay 9344
ptp4l[5817.714]: master offset 261 s2 freq -8544 path delay 8616
ptp4l[5818.714]: master offset -494 s2 freq -9221 path delay 8588
ptp4l[5819.715]: master offset -594 s2 freq -9469 path delay 8588
ptp4l[5820.715]: master offset -409 s2 freq -9463 path delay 8544

phc2sys -s eth0 -c CLOCK_REALTIME -w -q -m

phc2sys[5827.353]: phc offset 35950447461 s0 freq +0 delay 3720
phc2sys[5828.367]: phc offset 35950438138 s1 freq -9299 delay 3800
phc2sys[5829.370]: phc offset -16791 s2 freq -26090 delay 3720
phc2sys[5830.370]: phc offset 14730 s2 freq +393 delay 3680
phc2sys[5831.371]: phc offset 5749 s2 freq -4169 delay 3760
phc2sys[5832.371]: phc offset -2637 s2 freq -10830 delay 3760
phc2sys[5833.372]: phc offset 22752 s2 freq +13768 delay 3759
phc2sys[5834.372]: phc offset -27450 s2 freq -29608 delay 3760
phc2sys[5835.373]: phc offset 3138 s2 freq -7255 delay 3720
phc2sys[5836.373]: phc offset 4980 s2 freq -4472 delay 3720
phc2sys[5837.373]: phc offset -7288 s2 freq -15246 delay 3720
phc2sys[5838.374]: phc offset 2102 s2 freq -8042 delay 3719
phc2sys[5839.374]: phc offset 2061 s2 freq -7453 delay 3720
phc2sys[5840.375]: phc offset -2255 s2 freq -11151 delay 3720
phc2sys[5841.375]: phc offset -2802 s2 freq -12374 delay 3721

RTC: Wed Jun 8 10:34:25 2016 0.000000 seconds
PHC: 2016-06-08 10:35:00.084961211

-------------------------------------------------------------------------------
Slave2:

ptp4l -i eth0 -p /dev/ptp0 -f /etc/linuxptp/default.cfg -s -m

ptp4l[5794.721]: selected /dev/ptp0 as PTP clock
ptp4l[5794.757]: port 1: INITIALIZING to LISTENING on INITIALIZE
ptp4l[5794.760]: port 0: INITIALIZING to LISTENING on INITIALIZE
ptp4l[5799.390]: port 1: new foreign master 68c90b.fffe.24a105-1
ptp4l[5801.550]: selected best master clock 68c90b.fffe.249cdd
ptp4l[5803.389]: selected best master clock 68c90b.fffe.24a105
ptp4l[5803.391]: running in a temporal vortex
ptp4l[5803.393]: port 1: LISTENING to UNCALIBRATED on RS_SLAVE
ptp4l[5804.389]: master offset 621663936 s0 freq +0 path delay 0
ptp4l[5805.389]: master offset 621660116 s1 freq -3819 path delay 0
ptp4l[5806.389]: master offset -1577 s2 freq -5396 path delay 0
ptp4l[5806.391]: port 1: UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
ptp4l[5807.390]: master offset -7964 s2 freq -12257 path delay 7991
ptp4l[5808.390]: master offset 493 s2 freq -6189 path delay 7991
ptp4l[5809.390]: master offset 2843 s2 freq -3691 path delay 8058
ptp4l[5810.390]: master offset 2498 s2 freq -3183 path delay 8270
ptp4l[5811.390]: master offset 1901 s2 freq -3031 path delay 8270
ptp4l[5812.390]: master offset 1001 s2 freq -3360 path delay 8416
ptp4l[5813.391]: master offset 563 s2 freq -3498 path delay 8424
ptp4l[5814.391]: master offset 264 s2 freq -3628 path delay 8431
ptp4l[5815.391]: master offset 76 s2 freq -3737 path delay 8431
ptp4l[5816.391]: master offset 28 s2 freq -3762 path delay 8431
ptp4l[5817.391]: master offset 10 s2 freq -3772 path delay 8423
ptp4l[5818.391]: master offset 1 s2 freq -3778 path delay 8423
ptp4l[5819.392]: master offset -6 s2 freq -3784 path delay 8423
ptp4l[5820.392]: master offset -50 s2 freq -3830 path delay 8423

phc2sys -s eth0 -c CLOCK_REALTIME -w -q -m

phc2sys[5828.408]: phc offset 35621567434 s0 freq +0 delay 3800
phc2sys[5829.418]: phc offset 35621563619 s1 freq -3803 delay 3760
phc2sys[5830.423]: phc offset 3112 s2 freq -691 delay 3760
phc2sys[5831.423]: phc offset -2805 s2 freq -5675 delay 3720
phc2sys[5832.424]: phc offset -14338 s2 freq -18049 delay 3800
phc2sys[5833.424]: phc offset -1833 s2 freq -9845 delay 3721
phc2sys[5834.424]: phc offset 47771 s2 freq +39209 delay 3719
phc2sys[5835.425]: phc offset -49627 s2 freq -43858 delay 3721
phc2sys[5836.425]: phc offset 16395 s2 freq +7276 delay 3720
phc2sys[5837.426]: phc offset 9209 s2 freq +5008 delay 3759
phc2sys[5838.426]: phc offset -3540 s2 freq -4978 delay 3680
phc2sys[5839.426]: phc offset -2939 s2 freq -5439 delay 3720
phc2sys[5840.427]: phc offset -472 s2 freq -3854 delay 3720
phc2sys[5841.427]: phc offset -5922 s2 freq -9445 delay 3801
phc2sys[5842.428]: phc offset 2043 s2 freq -3257 delay 3720
phc2sys[5843.428]: phc offset 4164 s2 freq -523 delay 3760

RTC: Wed Jun 8 10:34:29 2016 0.000000 seconds
PHC: 2016-06-08 10:35:04.220653446

What am I doing wrong?

DSP
Richard Cochran
2016-06-08 11:43:45 UTC
Permalink
Post by DSP
The ptp hardware clock seems to be adjusted correct but with phc2sys i can't
set the RTC on the same value as the PHC. It is 36 seconds away like TAI-UTC.
The RTC should *not* have the same value as the PHC. The RTC uses the
UTC timescale, but the PHC uses TAI.

BTW, your nodes all have TAI-UTC = 35, not the current 36. (This
shows that you are using some version prior to 1.6.) If you want to
have the correct offset, use the "set GRANDMASTER_SETTINGS_NP" pmc
command.
Post by DSP
ptp4l -2 -i eth0 -p /dev/ptp0 -m
phc2sys -s eth0 -c CLOCK_REALTIME -w -m
RTC: Wed Jun 8 10:34:27 2016 0.000000 seconds
PHC: 2016-06-08 10:35:02.316598760
On the master, you are adjusting your CLOCK_REALTIME to follow the PHC
time. But what is setting the PHC time? Maybe you reversed the -s
and -c flags, but I don't know your intention.
Post by DSP
ptp4l -i eth0 -p /dev/ptp0 -f /etc/linuxptp/default.cfg -s -m
phc2sys -s eth0 -c CLOCK_REALTIME -w -q -m
RTC: Wed Jun 8 10:34:25 2016 0.000000 seconds
PHC: 2016-06-08 10:35:00.084961211
ptp4l -i eth0 -p /dev/ptp0 -f /etc/linuxptp/default.cfg -s -m
phc2sys -s eth0 -c CLOCK_REALTIME -w -q -m
RTC: Wed Jun 8 10:34:29 2016 0.000000 seconds
PHC: 2016-06-08 10:35:04.220653446
What am I doing wrong?
The slaves are configured to adjust their CLOCK_REALTIME (UTC) to
follow the PHC (TAI). The master gives the slaves the TAI time and
tells them that TAI-UTC=35. Then, phc2sys sets the system clock, and
you can see the 35 second offset.

So, there is nothing wrong with the slaves.

HTH,
d***@gmx.de
2016-06-08 13:34:48 UTC
Permalink
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
Richard Cochran
2016-06-08 14:08:23 UTC
Permalink
No html, please.

Thanks,
Richard
d***@gmx.de
2016-06-08 14:25:17 UTC
Permalink
Sorry, i hope now it is correct:

Hi Richard,
 
thanks for your help!
 
Post by DSP
The ptp hardware clock seems to be adjusted correct but with phc2sys i can't
set the RTC on the same value as the PHC. It is 36 seconds away like TAI-UTC.
The RTC should *not* have the same value as the PHC. The RTC uses the
UTC timescale, but the PHC uses TAI.
BTW, your nodes all have TAI-UTC = 35, not the current 36. (This
shows that you are using some version prior to 1.6.) If you want to
have the correct offset, use the "set GRANDMASTER_SETTINGS_NP" pmc
command.
 
Thanks for the hint, i have seen the master is old with 1.4 and the slaves have the new version
with 1.6
Post by DSP
ptp4l -2 -i eth0 -p /dev/ptp0 -m
phc2sys -s eth0 -c CLOCK_REALTIME -w -m
RTC: Wed Jun 8 10:34:27 2016 0.000000 seconds
PHC: 2016-06-08 10:35:02.316598760
On the master, you are adjusting your CLOCK_REALTIME to follow the PHC
time. But what is setting the PHC time? Maybe you reversed the -s
and -c flags, but I don't know your intention.
 
I use on the slave side the ptp timestamp with high accuracy for logging data,
parallel i want to capture some wireshark frames with tcpdump.
tcpdump uses the RTC so i'm not able to see directly the associated
timestamps of PTP and RTC.
This is the reason why i want to have the same time at PHC and RTC.
 
Is this possible?
Post by DSP
ptp4l -i eth0 -p /dev/ptp0 -f /etc/linuxptp/default.cfg -s -m
phc2sys -s eth0 -c CLOCK_REALTIME -w -q -m
RTC: Wed Jun 8 10:34:25 2016 0.000000 seconds
PHC: 2016-06-08 10:35:00.084961211
ptp4l -i eth0 -p /dev/ptp0 -f /etc/linuxptp/default.cfg -s -m
phc2sys -s eth0 -c CLOCK_REALTIME -w -q -m
RTC: Wed Jun 8 10:34:29 2016 0.000000 seconds
PHC: 2016-06-08 10:35:04.220653446
What am I doing wrong?
The slaves are configured to adjust their CLOCK_REALTIME (UTC) to
follow the PHC (TAI). The master gives the slaves the TAI time and
tells them that TAI-UTC=35. Then, phc2sys sets the system clock, and
you can see the 35 second offset.
So, there is nothing wrong with the slaves.
HTH,
 
DSP
 
 
Richard Cochran
2016-06-08 14:37:10 UTC
Permalink
Post by d***@gmx.de
I use on the slave side the ptp timestamp with high accuracy for logging data,
parallel i want to capture some wireshark frames with tcpdump.
tcpdump uses the RTC so i'm not able to see directly the associated
timestamps of PTP and RTC.
This is the reason why i want to have the same time at PHC and RTC.
Is this possible?
Yes, you can use "-O 0" on the phc2sys command line.

Warning: This won't work with 3rd party PTP equipment!

HTH,
Richard

Loading...