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:
- Collect the sync samples from all active sources in a single ring buffer.
- Only retain the N most recent samples that fall within the current one second interval.
- Perform a linear fit of the collected offset samples vs their arrival time after excluding 2-sigma outliers.
- Supply the predicted current offset to the tracking PLL.
- Update the frequency drift filter.
- 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
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.