Re: [Linuxptp-users] Dynamically sync clocks with phc2sys depending on master/slave
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Peter B. <pe...@be...> - 2021-10-13 07:51:13
|
Hi, On 2021-10-13 00:19, Richard Cochran wrote: > On Tue, Oct 12, 2021 at 09:47:21PM +0200, Peter Bergin wrote: >> Hi, >> >> I'm currently working on a network product using gPTP configuration for PTP >> sync. The device shall be a AVB endpoint handling audio and according to >> Avnu specifications all endpoint shall be capable of being master on the >> network. Some plugins for AVB (such as gstreamer and alsa-plugins) require >> that system time (CLOCK_REALTIME) is in sync with PHC to get correct timing. >> I see different cases depending on if the device is master or slave. If the >> device is slave I would like to sync PHC to CLOCK_REALTIME. The other way >> around, if device is master I would like to sync CLOCK_REALTIME to PHC. >> >> To the question; is there a way to use phc2sys and handle this >> automatically? > phc2sys has an automatic mode. See the man page for details. > Thanks! My bad, should have read man pages better. And I did try '-a' but had issues with it. To summarize for other users: $ ./phc2sys -a -r -r -q -m phc2sys[412816.955]: Waiting for ptp4l... phc2sys[412817.956]: Waiting for ptp4l... I had trouble communicating over UDS between ptp4l and phc2sys. The problem was that I'm working with gPTP (IEEE 802.11AS) and the setting transportSpecific didn't match between ptp4l and phc2sys. So the solution was, as stated in the man page, to add '--transportSpecific=1' when starting phc2sys and the issue was solved. ptp4l just silently drops messages if transportSpecific don't match (and ignore_transport_specific=0). I tried to debug this issue with help of debug messages (-l 7) but couldn't find it that way. Would it be a good thing to add debug prints when that happens to improve visibility? Or would that flood the log in some cases? diff --git a/port.c b/port.c index fa49663..1c04fc5 100644 --- a/port.c +++ b/port.c @@ -699,6 +699,8 @@ static int port_ignore(struct port *p, struct ptp_message *m) } if (p->match_transport_specific && msg_transport_specific(m) != p->transportSpecific) { + pr_debug("port %hu: transport_specific did not match, will drop message", + portnum(p)); return 1; } if (pid_eq(&m->header.sourcePortIdentity, &p->portIdentity)) { diff --git a/tc.c b/tc.c index 0346ba9..705f54c 100644 --- a/tc.c +++ b/tc.c @@ -478,6 +478,8 @@ int tc_ignore(struct port *p, struct ptp_message *m) if (p->match_transport_specific && msg_transport_specific(m) != p->transportSpecific) { + pr_debug("port %hu: transport_specific did not match, will drop message", + portnum(p)); return 1; } if (pid_eq(&m->header.sourcePortIdentity, &p->portIdentity)) { Thanks, /Peter |