> -----Original Message-----
> From: Thomas Behn [mailto:thomas.b...@meinberg.de]
> Sent: Monday, December 03, 2018 11:31 AM
> To: linuxptp-devel@lists.sourceforge.net
> Subject: [Linuxptp-devel] PHC delay when calling clock_gettime
> 
> Hi everyone,
> 
> 
> While developing a PTP slave using the Linux PHC, I noticed, that everytime I 
> call
> clock_gettime with the PHC ID, the time on the PHC jumps or at least changes 
> by
> around 200-300ns. I noticed this, because I have implemented an algorithm 
> reading
> the PHC time ten times in a row to find a best possible assumption of the 
> offset to the
> system time (as done in Ohly's timecompare). The second before the ten 
> readings, my
> measured PTP offset is a few ns, while directly after the readings it is 
> around 2.5us.
> The offset is stable below 200ns when not reading the PHC and leaving the 
> system
> time unsynchronized.
> 
> 

That seems like a bug in either the driver implementation, or in the hardware.

> While trying to find the mistake in my implementation, I found out that the 
> same
> thing happens if I use linuxptp and phc2sys. As long as phc2sys is not 
> running, linuxptp
> reports a pretty stable offset below 200ns, but as soon as I start phc2sys, 
> the offset
> increases to about 1us for a short time and is corrected by linuxptp a few 
> seconds
> later. Stopping phc2sys again results in the same behaviour, now with -1us 
> offset.
> From what I have seen in the code of phc2sys, it reads the PHC only five 
> times in a
> row, which explains that the offset is only 1us, compared to my 2.5us.

phc2sys is likely to call gettime at least once, so this I think is the same 
problem as above.

> 
> 
> My conclusion is, that each call of clock_gettime with the PHC ID, delays the 
> time of
> the clock by around 200-300ns. Is this a bug or expected behaviour? Or am I 
> doing
> something wrong?
> 

I suggest you read your hardware spec sheet and see if somehow reading the 
clock time causes it to be paused? That, or you've got something weird going on 
in your gettime implementation.

Unfortunately, none of us on the list are going to be experts in your hardware 
or software. I would be incredibly surprised if this was a bug in linuxptp or 
the PTP kernel subsystem.

> 
> Thanks in advance for your help!
> 
> 

Good luck!

Regards,
Jake


_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to