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

Similar projects worth following
Complete redesign of GPSDO Master Clock for improved accuracy and simplified connectivity.

Redesign of GPSDO Master Clock

Key Features:

  • Improved precision of PPS error measurement (8ns resolution)
    • Improved tracking accuracy against GPS time base
  • Software temperature compensation with online learning
    • Improved holdover accuracy
    • Learns temperature coefficient of crystal and adapts with crystal aging
  • PPS and 1 kHz reference outputs
  • Base 100-TX Ethernet
    • IEEE PTP Master
    • NTP Server
    • SNMP Server
    • DHCP Client

  • PTP Time Synchronization

    Robert Rouquette05/23/2023 at 20:26 0 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.

  • Progress Update

    Robert Rouquette05/02/2023 at 20:24 0 comments

    I've rewritten the frequency and offset correction code to be entirely digital and restructured the system clock to be a three layer structure with a free-running monotonic timescale, a frequency disciplined timescale, and an offset disciplined timescale.  The three-layer clock allows for independent disciplining of frequency and timing offset and improves overall tracking accuracy.  The system is now capable of frequency steering with a resolution of 0.232 ppb.

    In addition, I've restructured the GPSDO and NTP code into a single unit to make GPS/NTP fail-over more seamless and improve code reuse.  NTP source selection and health tests are still a WIP, but I've also implement support for select chronyc queries:

    • sources
    • sourcestats
    • ntpdata
    • tracking

    This allows for viewing fairly detailed status information with the chronyc utilty.

    A large benefit of this massive rewrite is that the frequency error measurement is now both precise and accurate enough to expose the presence of hysteresis loops in the tracking error.  Further analysis is needed to isolate the cause, but they still make some interesting patterns.  The loop widths are less than 30ppb,  and they were previously buried in the measurement noise.

  • MSP432E401Y vs TM4C1294NCPDT

    Robert Rouquette12/13/2022 at 00:19 0 comments

    After exhaustively comparing the datasheets and performing software tests on different eval boards, it's become clear to me that these two parts are functionally identical down to the pinout, register map, and address map.  The only difference I've been able to find is the onboard ROM.

    Thankfully, since I'm not using the ROM, I can use these parts interchangeably which makes sourcing them significantly easier.

  • Progress Update

    Robert Rouquette12/13/2022 at 00:11 0 comments


    • GPS status via UBX protocol. (lower overhead compared to NEMA 1803)
    • NTP client for fail-over on GPS/PPS loss.
    • Improved stability of temperature compensation.
    • Human-readable status via UDP port 23.

    Human readable status examples:

    $ echo -n 'ntp' | nc -uW1 -w1 #.#.#.# 23
    gps epoch:   0xE7423F96.71E6AA43
    ntp offset:  0xFFFFFFEE.00000000
    ntp servers:
        address          stratum  leap  reach  next  offset (ms)  delay (ms)  jitter (ms)  drift (ppm)  skew (ppm)  weight
      -            2     0  77777     8        2.750      29.478        0.328       -0.142       6.376  0.1159
      -          2     0  77777     5        7.713      23.209        0.390        0.317       8.137  0.0000
      -         2     0  77777    10        0.260       9.997        0.190        0.267       4.714  0.1568
      -          2     0  77777     7        2.613       7.500        0.404        1.649       8.263  0.0895
      -          3     0  77777     4        0.576      10.040        0.249        0.512       4.612  0.1603
      -           2     0  77777    10        5.772      29.849        0.178        0.402       3.595  0.2056
      -            2     0  77777     7        3.304      35.071        0.310        0.232       6.270  0.1179
      -         2     0  66767     4        0.970      25.825        0.194       -0.397       4.354  0.1540
    clock stratum: 1
    clock offset: 2.411 ms
    clock drift: 0.304 ppm
    leap indicator: 0 
    $ echo -n 'gpsdo' | nc -uW1 -w1 #.#.#.# 23
    pps locked: yes
    current offset: -88 ns
    mean offset: -17.6 ns
    rms offset: 42.9 ns
    frequency skew: 0.0215 ppm
    frequency correction: -175.9287 ppm
      - pll trimming: 0.0839 ppm
    compensation: -176.0126 ppm
      - temperature: 37.834 C
      - bias: 37.230 C
      - coefficient: 0.4296 ppm/C
      - offset: -176.2722 ppm

     Temperature Compensation Settling:

  • Progress Update

    Robert Rouquette05/28/2022 at 23:49 0 comments

    I've implemented SNMP and the GPSDO logic.  The software is currently using the frequency trimming support in the PTP hardware to under-clock the PPS and steer the edge alignment.  Otherwise, the temperature compensation and PLL logic are working as expected.  I still need to make a breakout board for the DXCO and I2C temperature sensor.

    Temperature Compensation:

    PPS Tracking:
    Comparison against GPS NTP server:

  • Progress Update

    Robert Rouquette05/21/2022 at 18:26 0 comments

    I've decided to modify the design to use the TM4C1294 series MCU.  It has essentially the same feature as the MSP432, but with a higher clock speed and it is currently in-stock at multiple suppliers.

    The CPU clock speed is nominally rated for 120MHz, but I have so far seen no issues overclocking it to 125 MHz to get a clean 8ns of timer resolution.  The 32-bit timers also seem to have no issue operating at 125 MHz.

    I've added an e-ink display to the design for debug and status purposes, and also implemented DHCP and NTP.

    I've been using an EK-TM4C1294XL eval board for prototyping. I'm currently working on an eval board layout for the DCXO and temperature sensor.  The GPS eval board should be arriving sometime next week.

View all 6 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates