xl4-shiro / excelfore-gptp

gPTP, IEEE 802.1AS-REV implementation
GNU General Public License v2.0
63 stars 38 forks source link

Question: Synchronizing the Hardware & System Clocks and Hardware Recommendations #3

Open schaveyt opened 4 years ago

schaveyt commented 4 years ago

I am still learning a bit here. If I were to follow along with this walk-through of setting up a linux system. But instead of using ptp4l, i replace it with this gptp software.

Can I assume the following:

  1. Synchronizing the PHC is handled by this gptp software as it requires the eth interfaces with HW TIMESTAMPING.

    • For PHC synching does it require all of the below to synch the PHC
      • hardware-transmit (SOF_TIMESTAMPING_TX_HARDWARE)
      • hardware-receive (SOF_TIMESTAMPING_RX_HARDWARE)
      • hardware-raw-clock (SOF_TIMESTAMPING_RAW_HARDWARE)
  2. Synchronizing the System Clock should still be handled using the phc2sys software from the linuxptp package?

Ultimately I want to try out this software's bridge mode. Any recommendations for some basic switch to use?

xl4-shiro commented 4 years ago

It is possible to work with software timestamps, like below software-transmit (SOF_TIMESTAMPING_TX_SOFTWARE) software-receive (SOF_TIMESTAMPING_RX_SOFTWARE)

When HW timestamps are not available, it unlikely has PTP clock and ethtool -T shows as bellow PTP Hardware Clock: none

To run with it, need to create a virtual ptp clock, which is created by adding a virtual network port. Running gptp2d as bellow $ gptp2d -d cbeth0,eth0 the first virtual network port:'cbeth0' creates a virtual ptp device, and gptp2d can run with the software timestamps on eth0.

With the software timestamps, the Pdelay value often goes beyond acceptable value on the other side, and in such case, the other side must be configured to accept big number of PDelay Value.

Regarding the 2nd question, If it means the system clock wants to synchronize gptp clock, it is just a matter of setting the system clock by gptp clock value. If gptp clock wants to start with synchronize to the system clock, use '-t' option with gptp2d.

schaveyt commented 4 years ago

Hmm. Still learning the term here. The object here would be to run this software on a switch whose role would be a AS-2011 PTP Relay Instance (a.k.a 1588 Boundary Clock).

This switch would say have its port 1 a slave to a PTP End Instance Grandmaster, and its other 4 switch port of this switch then act as master port to their connect PTP End Instances

  1. Is there a recommended, basic commandline usage for this situation?
  2. Do you have any recommended affordable off-the-shelf TSN switches you recommend playing with?
dancunogenda commented 3 years ago

I am currently doing what you are looking for. Running this software on a Linux machine to act as my Grandmaster. Then I have three TSN Evaluation Kits from Innovasics which can emulate PTP End Instances and act as Slaves in the network. Just building this software and configuring the Best Master Priorities to be anything above 248 results in a network with one GM and several Slaves depending on how many TSN Evaluation Kits you have.

This is the solution that worked for me. PTPdV2 and LinuxPTP all didn't work. My only problem with this, is that the first board connected to the server running this software has a huge offset but reports that the link delay is 0ns which I am not sure is correct.

xl4-shiro commented 3 years ago

How big the clock difference shouldn't matter to measure the Pdelay. If Pdealy is 0, there must be something wrong to measure it. It is likely that capturing timestamps is not working.

dancunogenda commented 3 years ago

So if this software is running on a Linux machine and we connect the cable from one port with another gPTP supporting device. The link delay shows that it is 0ns which is virtually not possible. There must be some difference when all the PTP event messages are being sent between the master and the slave. I expected the delay to be something but not 0. Do not know what causes this.

dancunogenda commented 3 years ago

Does anyone have an idea why, when trying to synchronize the Excelfore gptp to a different device, the Excelfore gptp complains about ERR:gptp:read_recdata:deviceIndex=0, no RX timestamp for msgtype=PDELAY_RESP, domain=0. It seems it's waiting for the response but never gets it back. Thanks and hope for some feedback