Cookie-GNSSDO
Introduction
How it's measured
Phase Offset / Satellites in View
Phase Offset: Histogram / CDF
Residual Allan Deviation
MTIE / TDEV
Controller activity
PI-State: Drift (I) vs. Jitter (P)
Summary
Conclusion

Hardware
NEO-M8N configure
FRDM-MCXN947 configure
Software
 

Introduction

Why Cookie-GNSSDO? Take a look at the picture:

A simple cookie tin served as a provisional ground plane for the active GNSS antenna.

Why this project?

It all started with a few videos by Jeff Geerling on the subject of PTP Grandmasters, and before I knew it, I had fallen down the rabbit hole. But instead of experimenting with Linux and Raspberry Pis, I decided to "push the bits" directly myself, as this is where my strengths lie.

The Plan: To realize a fully-fledged GNSS-Disciplined Oscillator (GNSSDO) using affordable, off-the-shelf evaluation boards, which could later serve as a clock source for a flexPTP based Grandmaster.

The Implementation: My design measures the offset between the GNSS-PPS and the IEEE-1588-PPS signal. A PI control loop ensures that the difference is driven towards zero – effectively disciplining the 1588 timer directly via the GNSS signal.

The Validation: Once the system was up and running, the question arose: How good is it really? Following a suggestion from an AI assistant, I performed a 24-hour data log for subsequent analysis. This analysis, including all diagrams and statistical metrics, was later carried out using AI-generated Python scripts to ensure an objective evaluation of the stability.

The GNSSDO is based on an NXP MCXN947 MCU and a u-blox NEO-M8N GNSS module. A simple cookie tin served as a provisional ground plane for the active GNSS antenna during the measurements. It was surprising to see how this pragmatic approach contributed to the achieved precision in the double digit nanosecond range.

With relatively simple means and total costs of under 100 USD, a level of precision was achieved that is demonstrated in the diagrams below. Over a 24-hour period, the system reached an MTIE of approx. 80 ns, an RMS jitter of approximately 10.3 ns, and a TDEV in the range of 80 to 110 ps. Whether this qualifies as a "high-precision" GNSSDO is left to the community to decide.

To ensure full transparency, I am making the entire project, including all raw data, scripts, and measurement logs openly available. Everyone is invited to verify the results for themselves.

How it's measured

To evaluate the performance of the control loop, the internal CTimer of the MCXN947 is used to capture the phase offset between the GNSS-PPS (Reference) and the Disciplined-PPS (Output).

  • Reference: u-blox NEO-M8N PPS signal.

  • Target: Local PPS generated by the 1588-Timer.

  • Resolution: With the CTimer running at 150 MHz, the measurement resolution is 6.67 ns per clock cycle.

This "Residual Measurement" illustrates the effectiveness of the control algorithm. It shows how precisely the PI-controller synchronizes the local timer to the GNSS time base, effectively filtering the GNSS jitter despite the 6.67 ns quantization of the timer.

Note on fixed delay compensation (GNSS_ANTENNA_DELAY_NS):

For evaluating control-loop performance (residual phase offset, jitter, ADEV, TDEV, MTIE), the measurement is referenced to the PPS signal as received at the board input (raw relative timing). Antenna cable delay compensation (e.g., ~25 ns for 5 m) is only applied when absolute UTC alignment or inter-device comparison is required.

Phase Offset / Satellites in View

This diagram forms the foundation of the entire evaluation, as it illustrates both the time offset and the GNSS reception conditions over the full measurement period.

(Click inside the picture to expand)

What you see:

This plot illustrates the fluctuation of the PPS offset between the GNSS signal and the disciplined oscillator over a 24-hour period.

  • Phase Offset (top): The offset predominantly stays within a range of approximately ±20 ns, with peak excursions reaching around ±35 ns.

  • Satellite Tracking (bottom): This curve shows the number of tracked satellites, which typically fluctuated between 17 and 27 during the measurement.

Why this matters:

  • Precision: The offset represents the actual real-time timing accuracy of the GNSSDO.

  • Correlation: The satellite count explains the stability (or noise) of the offset at any given time.

  • Performance Baseline: This diagram provides the crucial first impression of the overall system performance.

Phase Offset: Histogram / CDF

This diagram illustrates the statistical distribution of all measured PPS offsets over the full 24-hour period. While the time-series plot shows the performance over time, this visualization summarizes the frequency of specific offset values and highlights the typical operating range of the GNSSDO.

(Click inside the picture to expand)

The slight ripples in the histogram are a result of the system's discrete time resolution (quantization). Thanks to the long-term 24-hour observation, this quantization noise is statistically smoothed, revealing the true underlying performance of the oscillator.

What you see:

This diagram illustrates the statistical distribution of all measured PPS offsets over the full 24-hour period.

  • Histogram (top): This plot represents the frequency distribution of the measured offset values. It clearly shows that the majority of samples lie within approximately ±20 ns. The mean value is centered at approximately -0.2 ns, and the RMS jitter is 10.3 ns.

  • CDF Curve (bottom): Shows the cumulative percentage of measurements within a given offset range. It demonstrates high consistency: 95% of all values stay within ±20 ns, and 99% remain within ±25 ns.

Why this matters:

  • Short-term Stability: The histogram visualizes the short-term stability of the GNSSDO and illustrates how tightly the offset distribution is clustered.

  • Statistical Boundaries: The CDF provides concrete statistical limits that are critical for timing applications (e.g., 95% or 99% confidence intervals).

  • Reliability: Together, both plots provide a precise picture of how reliably and reproducibly the GNSSDO operates within the nanosecond range.

  • Quantitative Summary: This representation perfectly complements the time-series plot by summarizing the overall performance quantitatively.

Residual Allan Deviation

This diagram shows the Allan Deviation (ADEV) of the GNSSDO across various observation times (Tau). While previous plots focused on phase offset and its distribution, the Allan Deviation characterizes the frequency stability of the disciplined oscillator. It illustrates how effectively the loop filter suppresses both short-term noise and long-term drift.

(Click inside the picture to expand)

The steady decline of the curve demonstrates that the system becomes increasingly precise over longer observation periods. At an averaging time of approximately 2.8 hours (104 s) the frequency stability reaches a level of nearly 10-12, representing excellent performance for a disciplined standard crystal oscillator (XO).

What you see:

This plot illustrates how the Allan Deviation changes as the observation time (τ) increases.

  • Short-term Performance: For short intervals between 1 to 10 s, the ADEV stays within a range of approximately 10-8 to 10-9, which is characteristic of the jitter inherent in GNSS signals.

  • Long-term Stability: As the observation time increases, the ADEV continues to drop, reaching values between 10-10 and 10-11 for τ values of 100 to 1000 s.

  • Loop Efficiency: This downward trend confirms that the digital disciplining loop effectively smooths the oscillator, providing a highly stable frequency over extended periods.

Why this matters:

  • Core Metric: The Allan Deviation is the definitive metric for evaluating the frequency stability of an oscillator.

  • Loop Health: A consistently falling curve proves that the GNSSDO operates with long-term stability and that the loop filter parameters are correctly tuned.

  • Noise Analysis: ADEV allows for the identification of underlying noise sources, such as phase noise, flicker noise, or frequency drift.

  • Network Sync: For applications like PTP Grandmasters or time distribution systems, a low ADEV is critical, as it directly determines the quality of the generated PPS and IEEE 1588 signals.

  • Complementary Data: This plot complements the previous offset diagrams by visualizing the frequency-side performance of the system.

MTIE / TDEV

This diagram illustrates two critical metrics from telecommunications and synchronization engineering: Maximum Time Interval Error (MTIE) and Time Deviation (TDEV). Both metrics are used in ITU standards, such as G.8261 and G.8271, to evaluate the timing stability and accuracy of a clock system. While MTIE describes the maximum time error over various observation intervals, TDEV illustrates timing stability in a manner similar to Allan Deviation, but follows telecommunications industry definitions.

(Click inside the picture to expand)

Note: The rise at the end of the MTIE curve (near 105 s) is an artifact caused by the finite length of the 24-hour data set and does not indicate any system instability.

What you see:

  • MTIE (top): The Maximum Time Interval Error graph shows the peak phase deviation over time. For this 24-hour run, the error stays well below 80 ns.

  • TDEV (bottom): The Time Deviation curve highlights the precision in the time domain. It starts around 12 ns at Tau = 1 s and consistently drops, reaching its minimum between 80 ps and 110 ps at observation times of several thousand seconds.

  • Phase Noise suppression: The smooth, descending TDEV curve confirms that the system effectively filters out high-frequency jitter from the GNSS receiver.

Why this matters:

  • Network Limits: In professional telecommunications, MTIE is used to define wander masks. For this 24-hour capture, the MTIE stays well below 80 ns, which is a strong indicator of a high-quality clock source for packet-switched timing applications.

  • Sub-Nanosecond Precision: A TDEV minimum in the 80 to 110 ps range demonstrates that the disciplined loop provides very tight time stability at long observation intervals, comparable to what is often expected from much more expensive dedicated timing modules.

  • System Integrity: A smooth MTIE trace without sudden step changes indicates that the MCXN947 PI control loop maintained stable phase tracking throughout the full measurement window.

Controller activity (addend correction)

This diagram illustrates the progression of the timer addend correction over time. This value represents the frequency adjustments the GNSSDO applies to its local oscillator. The addend determines the rate at which the CPU's internal timer increments. Any changes directly reflect the effort required by the controller to keep the local oscillator synchronized with the GNSS signal. Consequently, this plot provides crucial insights into oscillator drift, thermal behavior, and the overall stability of the control loop.

(Click inside the picture to expand)

What you see:

  • Drift tracking: The addend trace follows the slow frequency drift of the crystal oscillator (temperature and aging), which is exactly what a GNSS-disciplined clock must compensate continuously.

  • Controller effort: Short-term wiggles reflect normal GNSS timing jitter and small loop corrections. The overall motion stays bounded, indicating stable loop operation without large corrective bursts.

Why this matters:

  • Loop transparency: The addend is the "control effort" signal. A smooth long-term trend with moderate short-term activity usually indicates a well-damped controller that is not fighting instability.

  • Hardware reality: A standard XO is never exactly on-frequency; the disciplined loop must keep adjusting the timer increment rate. This plot shows that the software is actively maintaining lock to the GNSS time base over the full 24-hour run.

  • Reproducibility: Because the addend reflects real environmental drift, it is also a practical sanity check that the measurement window captured normal operating conditions rather than an artificially quiet startup period.

This diagram does not just show the end result, but the actual "work in progress" of the PI controller. Since a standard crystal oscillator (XO) never vibrates at the exact target frequency and is highly sensitive to temperature fluctuations, the software must constantly provide active compensation.

PI-State: Drift (I) vs. Jitter (P)

This diagram illustrates the internal states of the PI controller that disciplines the oscillator. The P-term responds to short-term deviations (jitter), while the I-term compensates for the long-term drift of the local oscillator. This plot provides a direct look into the control loop's behavior and demonstrates how stably and cleanly the GNSSDO operates internally.

(Click inside the picture to expand)

The I-term smoothly follows the thermal drift of the crystal, while the P-term (shown here with a 60-second moving average) merely compensates for the unavoidable statistical noise of the GNSS receiver. This demonstrates a stable settling behavior and the absence of any dangerous resonances.

What you see:

  • P-Term Dynamics: The P-term curve shows fast, minor fluctuations within a range of a few ppb. These movements reflect the short-term GNSS jitter and demonstrate how the controller responds to rapid changes in offset. The low amplitude indicates a well-damped control loop.

  • I-Term Progression: The I-term is significantly smoother, showing gradual changes over the entire measurement period. This movement corresponds to the long-term drift of the XO oscillator caused by temperature fluctuations and the natural aging of the crystal. The I-term continuously compensates for this drift, keeping the oscillator aligned with GNSS time on average.

  • Synergy: Together, both curves illustrate how the PI controller simultaneously mitigates short-term disturbances and long-term drift.

Why this matters:

  • Sensitivity: The P-term demonstrates how the controller responds to short-term jitter. A stable progression indicates that the controller does not overshoot.

  • Drift Compensation: The I-term reveals the long-term compensation performance and provides insights into the quality and thermal stability of the local XO oscillator.

  • Loop Stability: The combination of both terms confirms whether the PI controller is stable, well-tuned, and free of oscillations.

  • Internal Dynamics: This plot is particularly valuable for developers, as it visualizes the internal dynamics of the control loop – something that cannot be identified from phase offset or ADEV plots alone.

  • Predictability: A clean and smooth progression of both terms confirms that the GNSSDO operates in a robust, stable, and predictable manner.

Summary

The following tables provide a compact summary of all key measurement results from the evaluation. The first table contains the core timing metrics that describe the external performance of the GNSSDO – including offset stability, jitter, Allan Deviation, and time error limits. The second table focuses on the controller metrics, offering insights into the internal behavior of the PI loop and illustrating the oscillator's drift and jitter compensation. Together, these tables provide a clear and comprehensive overview of the overall performance and stability of the GNSSDO

Timing Metrics (GNSSDO Performance)

Metric Value(s) Unit Meaning / Interpretation
Phase Offset typ. ±20, max. ±35 ns Short-term deviation between GNSS and 1588 timer.
Satellites (Used) 17 to 27 count High redundancy and stability through Multi-GNSS.
Histogram Mean -0.2 ns Near-zero systematic time error (Bias).
RMS Jitter 10.3 ns Short-term precision of the disciplined clock.
CDF 95% Range ±20 ns 95% of all offsets fall within this confidence interval.
CDF 99% Range ±25 ns 99% of all offsets fall within this confidence interval.
ADEV (1 to 10 s) ~10-9 Characteristic short-term GNSS jitter.
ADEV (100 to 1,000 s) 10-10 to 10-11 Excellent long-term frequency stability.
ADEV (10,000 s) 1.9 × 10-12 Frequency stability in the parts-per-trillion range.
MTIE (1 to 100,000 s) 60 to 80 ns Maximum Time Interval Error over 24 h.
TDEV Minimum 80 to 110 ps Time stability (complementary to ADEV).

Controller Metrics (PI Loop Behavior)

Metric Value(s) Unit Meaning / Interpretation
Addend Correction -8,400 to -9,860 ppb Total correction range required to compensate for crystal drift.
P-Term StdDev 15.48 ppb Metric for control loop stability and effective jitter attenuation.
Controller Behavior Stable No oscillations or resonances observed within the PI loop.

Conclusion

Since I do not have years of experience in high-precision metrology to evaluate these results conclusively, I submitted the data to an AI for analysis. Below is the AI-generated summary of the project:

"The present analysis proves that modern general-purpose GNSS modules like the u-blox NEO-M8N, combined with a precise digital control loop and the use of IEEE 1588 hardware support, deliver results that were previously reserved for expensive specialized hardware.

Despite its pragmatic construction, the system achieves a stability (ADEV in the 10-12 range) and a timing accuracy (RMS jitter ~10.3 ns) that qualify it for demanding synchronization tasks in PTP environments. This makes the Cookie-GNSSDO proof that high-end performance is now achievable with affordable, off-the-shelf components."

Hardware

The required hardware is affordable, with total component costs amounting to approximately 96 USD (plus taxes/shipping). Below are the prices at the time of writing:

In total, the setup stays just under the 100 USD mark.

This is what the FRDM-MCXN947 looks like with the GNSS 5 click mounted:

For optimal performance, it is recommended to place the active GPS antenna on a metallic surface (ground plane). Even a simple metal cookie tin, as used in this project, works perfectly to improve the signal quality.

To use the GNSS 5 click (NEO-M8N) for this GNSSDO project, a small hardware modification is required to route the Timepulse (PPS) signal correctly. Since the pins on the NEO-M8N module are easily accessible, this can be done with just a bit of soldering. See the image below for the exact pin locations:

  • Step 1: Create a solder bridge between Pin 5 and Pin 6 directly on the NEO-M8N module.

  • Step 2: Use a thin magnet wire to connect Pin 3 with Pin 15.

This modification ensures that the MCU receives the high-precision pulse via the MikroBUS header, which is essential for frequency synchronization.

NEO-M8N configure

For optimal performance as a GNSS source for the GNSSDO, the NEO-M8N must be configured accordingly. By default, these modules are typically set to standard parameters for mobile navigation, which is not ideal for a high-precision time base.

For the configuration, I used u-center version v25.06. The configuration is performed within u-center using the "Configuration View" window.


First, the communication speed of the serial interface is adjusted to ensure smooth data transmission:


The configuration is performed in three simple steps:

  1. Selection: Select PRT (Ports) from the list on the left.

  2. Setting: Change the Baudrate to 115200.

  3. Apply: Click the Send button to transfer the setting to the module.


To improve the stability of the time base with a fixed antenna, the dynamic model is changed to "Stationary".

  1. Selection: Select NAV5 (Navigation 5) from the list on the left.

  2. Setting: Change the Dynamic Model to 2 - Stationary.

  3. Apply: Click the Send button to transfer the setting to the module.


To avoid unpredictable correction calculations that could affect the jitter of the time pulse, the SBAS function is disabled:

  1. Selection: Select SBAS (SBAS Settings) from the list on the left.

  2. Setting: Set Subsystem to Disabled.

  3. Apply: Click the Send button to transfer the setting to the module.


To optimize processing performance, only the GPS, Galileo, and GLONASS systems are enabled, while all others (e.g. BeiDou, QZSS) are disabled:

  1. Selection: Select GNSS (GNSS Config) from the list on the left.

  2. Setting: Enable the checkboxes for GPS, Galileo, and GLONASS. Disable all other systems.

  3. Apply: Click the Send button to transfer the setting to the module.


Finally, the changes must be saved permanently so that they are not lost after a restart or power failure:

  1. Selection: Select CFG (Configuration) from the list on the left.

  2. Setting: Ensure that Save current configuration is selected and highlight the entries 0 - BBR and 2 - FLASH under "Devices".

  3. Apply: Click the Send button to write the configuration permanently to the memory.


This completes the configuration of the NEO-M8N, and the module is now optimally prepared for use as a precise time reference in the GNSSDO.

FRDM-MCXN947 configure

More details coming soon – stay tuned!

Software

First of all, the toolchain. The embedded firmware is developed using SEGGER Embedded Studio, which is available free of charge for non-commercial use under SEGGER's Friendly License.

The following components form the basic foundation:

The software core of the GNSSDO relies on the CTimer peripheral of the MCXN947 to precisely capture the PPS signal from the GNSS module. To minimize overhead and latency, NMEA messages are entirely disabled in favor of the binary UBX protocol.

More details coming soon – stay tuned!