Thread: [Linuxptp-users] Grandmaster with gps pps
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Rob C. <RCo...@si...> - 2018-06-21 11:58:43
|
I have a setup with master and slave working with ptp supported imx6 macs. On master I have a GPS module with serial reports and a pps signal hooked up to a GPIO on the imx. I know for a different nic like the i210, it has some specific SDPs that can be used for the PPS input - and this could be used to discipline the phc in the nic directly. For my current setup I think I would have to discipline the system clock with gspd and ntp or chrony, then use phc2sys to sync the system clock to the phc? Is this on the right track? And would having the pps not directly into the mac cause major accuracy issues? We were looking for +-1usec. Thanks, Rob C |
From: Miroslav L. <mli...@re...> - 2018-06-21 12:36:12
|
On Thu, Jun 21, 2018 at 12:24:15AM -0700, Rob Cornall wrote: > I have a setup with master and slave working with ptp supported imx6 macs. > > On master I have a GPS module with serial reports and a pps signal hooked up > to a GPIO on the imx. > I know for a different nic like the i210, it has some specific SDPs that can be used > for the PPS input - and this could be used to discipline the phc in the nic directly. > > For my current setup I think I would have to discipline the system clock with gspd > and ntp or chrony, then use phc2sys to sync the system clock to the phc? > > Is this on the right track? And would having the pps not directly into the mac > cause major accuracy issues? We were looking for +-1usec. Synchronizing the PHC to the system clock will probably have a negative effect on the accuracy. It depends on the HW. For 1us accuracy it might be ok. A bigger problem might be with the PPS timestamping. I'm not sure how exactly it works with the imx. If the kernel is timestamping interrupts triggered by the PPS, that will probably add an error of at least few microseconds, maybe even few tens of microseconds. Unless you can measure the delay and make sure it's stable, 1us accuracy is not realistic. The PPS needs to be timestamped by the HW (like with the i210), or by the kernel polling the GPIO pin (assuming the reading is fast enough). -- Miroslav Lichvar |
From: Richard C. <ric...@gm...> - 2018-06-21 14:34:18
|
On Thu, Jun 21, 2018 at 02:36:02PM +0200, Miroslav Lichvar wrote: > On Thu, Jun 21, 2018 at 12:24:15AM -0700, Rob Cornall wrote: > > I know for a different nic like the i210, it has some specific SDPs that can be used > > for the PPS input - and this could be used to discipline the phc in the nic directly. IIRC the imx also has input pins. > A bigger problem might be with the PPS timestamping. I'm not sure how > exactly it works with the imx. If the kernel is timestamping > interrupts triggered by the PPS, that will probably add an error of at > least few microseconds, maybe even few tens of microseconds. Unless > you can measure the delay and make sure it's stable, 1us accuracy is > not realistic. Right. The delay from interrupt to interrupt handler can be even hundreds of usec, at it will have jitter. > The PPS needs to be timestamped by the HW (like with the i210), or by > the kernel polling the GPIO pin (assuming the reading is fast enough). Right. Thanks, Richard |
From: Rob C. <RCo...@si...> - 2018-06-23 01:13:11
|
The 06/21/2018 07:34, Richard Cochran wrote: > On Thu, Jun 21, 2018 at 02:36:02PM +0200, Miroslav Lichvar wrote: > > On Thu, Jun 21, 2018 at 12:24:15AM -0700, Rob Cornall wrote: > > > I know for a different nic like the i210, it has some specific SDPs that can be used > > > for the PPS input - and this could be used to discipline the phc in the nic directly. > > IIRC the imx also has input pins. > > > A bigger problem might be with the PPS timestamping. I'm not sure how > > exactly it works with the imx. If the kernel is timestamping > > interrupts triggered by the PPS, that will probably add an error of at > > least few microseconds, maybe even few tens of microseconds. Unless > > you can measure the delay and make sure it's stable, 1us accuracy is > > not realistic. > > Right. The delay from interrupt to interrupt handler can be even > hundreds of usec, at it will have jitter. > > > The PPS needs to be timestamped by the HW (like with the i210), or by > > the kernel polling the GPIO pin (assuming the reading is fast enough). > > Right. > > Thanks, > Richard Well the results are exactly as you say from my testing, we are seeing a pretty constant offset of +25usecs when measuring PPS output on master FEC vs GPS PPS output. (we are running phc2sys -a -r -r to sync System clock to phc on master) I guess for 1us accuracy we will have to connect the GPS PPS directly to the imx6 FEC instead of a GPIO - Another question about connecting the PPS, It does look like there are input pins on imx6 FEC, Do I only need to connect the 1PPS to said pin? My thinking is this: - Initially discipline the PHC with phc2sys using the system clock time (which is set from the GPS NMEA serial stream) - Since this initial time will be within 1 second accuracy, we can use the PPS from here to adjust the PHC. Also it doesn't look like the imx6 fec_ptp driver supports input PPS for Grand master support, do you if any work is happening for this? Appreciate the help. -- Thanks, Rob |
From: Richard C. <ric...@gm...> - 2018-06-23 02:25:01
|
On Sat, Jun 23, 2018 at 12:40:33AM +0000, Rob Cornall wrote: > Another question about connecting the PPS, It does look like there are input pins on imx6 FEC, > Do I only need to connect the 1PPS to said pin? Not only that, but you'll have to get the time stamps and use them to discipline to PHC. > Also it doesn't look like the imx6 fec_ptp driver supports input PPS for Grand master support, > do you if any work is happening for this? I thought that has been done already, but I just took a look at mainline and net-next linux, and it hasn't been done. I don't know if anyone is working this either. Sorry, Richard |
From: Richard H. <pl...@gm...> - 2018-06-25 13:43:37
|
Not directly related to this, but ... Having spent some time modifying the FEC driver, I can highlight some things to be aware of 1. The hardware nanosecond counter is not the same as PTP nanoseconds. PTP time is held as a variable, not by FEC 2. The PPS-OUT signal does fire each second, but is not necessarily aligned to PTP 0 nanoseconds 3. MAC/PHY resets will kill PPS-OUT (eg link down/up) 4. To get sub 100ns accuracy, you're likely going to need external hardware to control the system clock by measuring the difference between GPS-PPS and PPS-OUT. (You can then do fine adjustment of PTP time) 5. In my experience, PPS-in via GPIO just has far too much jitter to be useful. Regards Richard (H) -----Original Message----- From: Richard Cochran [mailto:ric...@gm...] Sent: Samstag, 23. Juni 2018 03:25 To: Rob Cornall Cc: lin...@li... Subject: Re: [Linuxptp-users] Grandmaster with gps pps On Sat, Jun 23, 2018 at 12:40:33AM +0000, Rob Cornall wrote: > Another question about connecting the PPS, It does look like there are input pins on imx6 FEC, > Do I only need to connect the 1PPS to said pin? Not only that, but you'll have to get the time stamps and use them to discipline to PHC. > Also it doesn't look like the imx6 fec_ptp driver supports input PPS for Grand master support, > do you if any work is happening for this? I thought that has been done already, but I just took a look at mainline and net-next linux, and it hasn't been done. I don't know if anyone is working this either. Sorry, Richard ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linuxptp-users mailing list Lin...@li... https://lists.sourceforge.net/lists/listinfo/linuxptp-users |
From: Richard C. <ric...@gm...> - 2018-06-25 14:37:57
|
On Mon, Jun 25, 2018 at 02:43:27PM +0100, Richard Hill wrote: > 1. The hardware nanosecond counter is not the same as PTP nanoseconds. PTP time is held as > a variable, not by FEC You can and should use timecounter_cyc2time() to convert raw cycle counts into PTP time. > 2. The PPS-OUT signal does fire each second, but is not necessarily aligned to PTP 0 > nanoseconds Looks like the driver's author neglected the frequency adjustment on the PTP time when setting the interrupt. > 4. To get sub 100ns accuracy, you're likely going to need external hardware to control the > system clock by measuring the difference between GPS-PPS and PPS-OUT. (You can then do > fine adjustment of PTP time) Forget about the "pps". You don't need it for implementing a GM. All you need is the 1-PPS signal from the GPS into the FEC. Then you can serve the GPS time via PTP. The Linux system time is irrelevant in this case. HTH, Richard |
From: Rob C. <RCo...@si...> - 2018-06-25 17:58:17
|
The 06/25/2018 14:43, Richard Hill wrote: > 1. The hardware nanosecond counter is not the same as PTP nanoseconds. PTP time is held as > a variable, not by FEC > 2. The PPS-OUT signal does fire each second, but is not necessarily aligned to PTP 0 > nanoseconds This will not be an issue for offset measurement purposes correct? > 3. MAC/PHY resets will kill PPS-OUT (eg link down/up) > 4. To get sub 100ns accuracy, you're likely going to need external hardware to control the > system clock by measuring the difference between GPS-PPS and PPS-OUT. (You can then do > fine adjustment of PTP time) I think as Richard said, the idea now is just connecting 1PPS to the FEC directly, now the time served by Grandmaster should be accurate enough. One thing I am unsure of (and unsure how to accurately measure), Should I be worried about possible latency/jitter of synching ptp time to system clock on the slave devices (with phc2sys -a -r)? > 5. In my experience, PPS-in via GPIO just has far too much jitter to be useful. So have you actually connected PPS to an FEC ENET_1588_EVENT#_IN pin on the imx, and modify the driver to use this for adjusting clock frequency? Thank you for sending these points my way. -- Rob |
From: Richard H. <pl...@gm...> - 2018-06-27 05:13:24
|
> So have you actually connected PPS to an FEC ENET_1588_EVENT#_IN pin on > the imx, and modify the driver to use this for adjusting clock frequency? Until very recently, I've not had hardware where this connector has been available, so that's why I've had to use the external GPS-PPS/PPS-OUT compare method. This is more complicated, but does give good results. I will return with results from using PPS-IN as soon as I have them. Richard (H) |