1588 clock synchronization using ptp4l, but invalid

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

1588 clock synchronization using ptp4l, but invalid

5,206件の閲覧回数
pengjing918
Contributor II

I use the officially provided image directly, support ethtool, ptp4l commands in the image, and support hard timestamps. ethtool executes as shown below:

pastedImage_3.png

However, I use the ptp4l tool to perform clock synchronization. The master offset has been increasing and has been in the s0 state, as shown in the figure:

pastedImage_1.png

Looking forward to your reply, thank you

ラベル(2)
タグ(4)
0 件の賞賛
14 返答(返信)

4,503件の閲覧回数
art
NXP Employee
NXP Employee

The IEEE 1588 protocol is completely implemented in the Linux driver, there is nothing to add here.

The protocol only synchronizes the hardware clock frequencies, not the time counter values.

0 件の賞賛

4,503件の閲覧回数
pengjing918
Contributor II

Hi Artur,

Thank you for your reply

As you said, the 1588 protocol has been implemented. I used ptp4l + phc2sys to achieve time synchronization between the two hosts. Using the date command, the time is consistent. But I still have some questions.
1. Synchronize the clock frequency only, how is the time synchronized? Do you have trouble explaining the relationship between clock frequency and time stamp? Thank you
2. Can I get the PHC time directly? The following code:

#define PTP_CLOCK_0_PATH "/dev/ptp0"

int main()
{
   int ptp_clk_id = open(PTP_CLOCK_0_PATH, O_RDONLY);
   if(ptp_clk_id == -1){
      printf("ptp clock open fail\n");
      return -1;
   }
   struct timespec ts;
   clock_gettime(ptp_clk_id, &ts);//CLOCK_REALTIME
   printf("ptp clock open ok\n");
   printf("ts.tv_sec: %ld, ts.tv_nsec: %ld\n", ts.tv_sec, ts.tv_nsec);
   close(ptp_clk_id);
   return 0;
}

The results are as follows:

root@imx6qsabresd:/mnt/test# ./ptp_clock_time
ptp clock open ok
ts.tv_sec: 0, ts.tv_nsec: 9609002

0 件の賞賛

4,503件の閲覧回数
art
NXP Employee
NXP Employee

The Linuxptp PTP stack implementation is supported in the current Linux BSP. For details, please refer to the Section 4.2 "ENET IEEE-1588" of the attached document.

Best Regards,
Artur

0 件の賞賛

4,503件の閲覧回数
pengjing918
Contributor II

pastedImage_1.png

The manual says "By default, ENET 1588 is enabled.", however, the ptp4l command does not synchronize the clock.

0 件の賞賛

4,503件の閲覧回数
art
NXP Employee
NXP Employee

What hardware (on both sides of the communication) and what exactly software do you use? Please specify.

0 件の賞賛

4,503件の閲覧回数
pengjing918
Contributor II

Both ends of the communication use the imx6q chip, the mac layer 1588 communication, the software uses linuxptp

0 件の賞賛

4,503件の閲覧回数
art
NXP Employee
NXP Employee

Is Linux, running on your hardware, based on some Linux BSP by NXP? If so, which one is used (specify the kernel version and release number).

0 件の賞賛

4,503件の閲覧回数
pengjing918
Contributor II

ptp4l slave

Linux imx6 3.14.52-rt52+g5f6f0a5 #2 SMP PREEMPT RT Fri Aug 2 12:21:15 CST 2019 armv7l GNU/Linux

ptp4l host

Linux imx6qsabresd 4.1.15-00017-gf94be3a-dirty #1 SMP PREEMPT Mon Dec 3 16:20:20 CST 2018 armv7l armv7l armv7l GNU/Linux

Like the two board chips, the core board is different.

As mentioned above, after the two boards start linux, the log shows that they all support ptp clock.

However, using the ptp4l command in the manual, hard clock synchronization is invalid.

0 件の賞賛

4,503件の閲覧回数
art
NXP Employee
NXP Employee

Actually, PTP is not properly implemented in the 3.14.52 BSP. Better is to migrate to latest 4.14.98 BSP on both Host and Slave boards.

0 件の賞賛

4,503件の閲覧回数
pengjing918
Contributor II

Hello there;
   First of all, I am very grateful for your help to me during this time! But I still have problems.
   1. I used two identical boards, one as the master clock and one as the slave clock. Using ptp4l for clock synchronization, the master offset value is around a single digit, but the system time has not changed.
   2. "ptp hardware clock: 0" What is the meaning of this sentence? If it is 0, can you still perform hard timestamp synchronization? If not, then how can I solve this problem?
   Looking forward to your reply, thank you!

pastedImage_1.png

pastedImage_3.png
0 件の賞賛

4,503件の閲覧回数
art
NXP Employee
NXP Employee

1. Since the master offset time units are nanoseconds, the clock adjustment may just be too small to be reflected in the standard system time representation.

2. "PTP Hardware Clock: 0" is just the mnemonic name of the hardware clock selected. You can perform the hard timestamp synchronization.

Some general PTP management information can be found, for example, here:

Precision Time Protocol | System Analysis and Tuning Guide | openSUSE Leap 15.1 

0 件の賞賛

4,503件の閲覧回数
pengjing918
Contributor II

Hi Artur,
What I need to implement is the MAC layer of 1588.
1. "but the system time has not changed."; The slave has a time difference with the host, but after synchronization, there is still a time difference between the slave and the host, and the difference is unchanged.
2. I saw a lot of discussions about 1588 clock synchronization in the forum. There are some points that I don't understand.
1> I need to define MX6QDL_PAD_GPIO_16__ENET_REF_CLK, what does it mean?
2> What does 1PPS mean? Is there a frame of synchronized data every second?
3> Do I need to configure GPIO_19 as ENET_1588_EVENT0_OUT?
4> In the IMX6DQRM.pdf manual, 23.3 External Signals section says ENET_1588_EVENT0_IN and ENET_1588_EVENT0_OUT, do I need to configure it? If so, how do I configure it?
There are a lot of questions, please reply in detail, or be able to provide a detailed documentation on the configuration of MAC 1588. Thank you!

0 件の賞賛

4,503件の閲覧回数
pengjing918
Contributor II

?

0 件の賞賛

4,503件の閲覧回数
pengjing918
Contributor II

The linux boot log is as follows:

pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered

0 件の賞賛