I had an iMX6 board running steady at <50ns using an external circuit to adjust the 125MHz system clock, from which the AVTP counter is incremented.
It can be done Richard H -----Original Message----- From: Irene Kravets [mailto:ire...@sapling-inc.com] Sent: Mittwoch, 19. August 2020 13:49 To: linuxptp-users@lists.sourceforge.net Subject: Re: [Linuxptp-users] Can ptp4l be used without phc2sys? So, it sounds to me like fec_ptp and therefore i.MX6 might not be the best hardware to use for precise PTP implementation (20-30 nsec PPS sync). Can I please get some recommendations for a reference board I can purchase that would run linuxptp and produce desired results? It should have 2 Ethernet ports (with at least one of them supporting HW PTP), I2C, SPI, SD card and USB. I don't need WiFi. I would really appreciate any recommendations. Thank you, Irene. ---------------------------------------------------------------------- Date: Wed, 19 Aug 2020 10:41:36 +0200 From: Hannes Mayr <hannes.m...@microgate.it> To: linuxptp-users@lists.sourceforge.net Subject: Re: [Linuxptp-users] Can ptp4l be used without phc2sys? Message-ID: <55baa75d-980e-5082-0ed2-6ec594d78...@microgate.it> Content-Type: text/plain; charset=utf-8; format=flowed On 18/08/2020 23:47, Jacob Keller wrote: > > On 8/18/2020 12:40 PM, Irene Kravets wrote: >> I am using vendor kernel and a vendor-specific PTP driver (drivers/net/Ethernet/freescale/fec_ptp.c). I see this driver in the mainline kernel as well. What enables PPS output signal is the PTP_ENABLE_PPS ioctl sent from linuxptp stack (in phc2sys.c). > It's possible the driver assumes "PTP_ENABLE_PPS" is for enabling the > PPS output signal. I know I've had plenty of discussion with > colleagues trying to explain the difference between PTP_ENABLE_PPS and > PTP_PEROUT_REQUEST... So I would imagine other vendors might also get > this wrong sometimes. > > Enabling the input and output pins should be done through the > PTP_PEROUT_REQUEST and PTP_PIN_SETFUNC ioctls. That's not true for the fec_ptp driver. Looking to the driver code when the PTP_ENABLE_PPS ioctl is called the call stack is as follows: ptp_chardev.c:ptp_ioctl() -> issues a PTP_CLK_REQ_PPS request to the underlying PTP driver (fec_ptp in this case) fec_ptp.c:fec_ptp_enable() -> Checks for PTP_CLK_REQ_PPS fec_ptp.c:fec_ptp_enable_pps() -> Sets up the output compare PTP_PEROUT_REQUEST is not supported by the fec driver. The IMX6 provides 4 output channels for IEEE1588 on different pads (ENET_1588_EVENTx_OUT) which can be used to output the PPS. But it looks like the fec driver is only using channel 0 hard-coded as output. The timer register is double-buffered, while the timer is running the next compare value can be written and it needs to the updated constantly before overflowing. What seems odd to me is that the driver is reading back the PTP timer to calculate the first compare match value. If the driver code gets interrupted by interrupt or other kernel threads in that instant the compare match (and so the PPS) will have a constant offset. Additionally, as Richard already pointed out, if there is applied a frequency adjustment on the PTP timer at the same time this doesn't look to work well. IMHO to implement the PPS setup correctly the timer would have to be stopped first. Regards, Hannes _______________________________________________ Linuxptp-users mailing list Linuxptp-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-users _______________________________________________ Linuxptp-users mailing list Linuxptp-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-users