Discussion:
[Linuxptp-users] Can phc2sys sync two physical clocks?
John Hubbard
2016-03-17 22:02:45 UTC
Permalink
As I understand it the phc2sys package is generally responsible for
synchronizing a physical clock to the system time or vice versa. Is it
possible to use the package to synchronize two physical clocks?

In my case I'm looking to take wall time as determined by a NIC that
supports hardware timestamping using the ptp4l package and write that
time to a DIO card that has its own internal clock. We were using a
previous version of the DIO card which had an ethernet input and was
capable of synchronizing itself to PTP. The new version lacks that
feature. In case it helps the card in question is a Spectracom TSync
PCIe; we are using the cards input time stamping, and output match time
features.

My hope is that you, who are more knowledgeable on time than I, might
have suggestions on the best way to synchronize the card's time with the
incoming PTP time. Is my best bet to read the system time via
std::chrono::system_clock::now() and then write that time to my DIO
card. Is there some way to read the current time directly from
/dev/ptp0? Is there an easy way to extend phc2sys to write the time to
my DIO card?

Thanks in advance for any suggestions.
--
-john

To be or not to be, that is the question
2b || !2b
(0b10)*(0b1100010) || !(0b10)*(0b1100010)
0b11000100 || !0b11000100
0b11000100 || 0b00111011
0b11111111
255, that is the answer.
Ledda William EXT
2016-03-18 08:07:10 UTC
Permalink
This post might be inappropriate. Click to display it.
Richard Cochran
2016-03-18 10:03:27 UTC
Permalink
Post by Ledda William EXT
As far as I know, to control the clock of your DIO from phc2sys you
need to “expose” the clock implementing the PHC kernel interface in
the driver…
Yes, but the DIO card doesn't need to be a PHC (= PTP Hardware Clock),
it only needs to be a "Dynamic" POSIX clock.

The driver interface is defined in include/linux/posix-clock.h in the
Linux kernel sources. Right now, the only driver implementing this
feature is the PHC layer (see drivers/ptp/ptp_clock.c).

So the DIO card needs a device driver that implements a dynamic clock.
In addition to getting and setting the time, the card and driver will
need to support frequency adjustment.

Once you have the DIO driver, then the phc2sys program will work
without modifications.

HTH
Richard

Loading...