Close

PTP Time Synchronization

A project log for GPSDO IEEE PTP Master

GPS disciplined DCXO with software temperature compensation and IEEE 1588 PTP master

robert-rouquetteRobert Rouquette 05/23/2023 at 20:260 Comments

I've successfully synchronized an embedded PTP client with the GPS time server.  I still need to verify that I'm correctly setting some of the protocol fields, but I've otherwise managed to get +/- 100ns tracking over a single switch hop using the IEEE 802.1AS gPTP profile.  The gPTP profile uses raw ethernet frame encapsulation with the 0x88F7 ether type.  I decided to use this particular profile since it provides a simple zeroconf style configuration.

On the client side, I've implemented the offset tracking as 1 Hz update process with three stages:

  1. Collect the sync samples from all active sources in a single ring buffer.
    1. Only retain the N most recent samples that fall within the current one second interval.
  2. Perform a linear fit of the collected offset samples vs their arrival time after excluding 2-sigma outliers.
  3. Supply the predicted current offset to the tracking PLL.
  4. Update the frequency drift filter.
    1. Update frequency correction using 2-sigma filtered mean.

The result is a surprisingly clean and consistent offset tracking error.

MAC Address       Sync  Delay
54:55:58:D2:83:2F   -3    8.264 us

offset measurement:
  - used:         6
  - drift:        0.083 ppm
  - mean:         0.029 us
  - dev:          0.032 us

drift measurement:
  - used:        16
  - mean:        -0.005 ppm
  - dev:          0.100 ppm
Since I've now confirmed that this time keeping approach works, I plan to focus on completing the board layout so I can order prototypes and finalize the hardware design.

Discussions