STM32F4 time experiments

other runs and more info

Goal

1ms or better accuracy on a USB-connected GPS.

Changes from Run 9

Filter now measures the difference between the moving average offset and the sampled offsets for the past 192 seconds, and selects a filter that discards 20% of the samples before selecting the offset to send to NTP. The micro's PLL now uses 2mhz as its intermediate frequency instead of 1mhz, to evaluate its effect on jitter

Graphs

PC clock

Loopstats graph - local clock error (PPM, green) and USB/GPS offset (µs, red)

ntpd's measurement of jitter


Comparison of run9 and run10 jitter:
percentileRun 9Run 10
50%2 µs1 µs
90.0%6 µs2 µs
99.0%12 µs3 µs
99.9%19 µs8 µs

Filter

This is a close-up view of 2 minutes worth of data. The red is the raw samples (in µs), the green is the offset sent to NTP (in µs), and the blue and and purple lines are the min/max filters

You can see the filter reacting to a variety of sample conditions, while still rejecting the majority of noise

Comparison of microcontroller's clock


Changing the PLL's intermediate frequency from 1mhz to 2mhz did not change the microcontroller's clock wander or jitter significantly

Overall conclusion

The filter made a huge difference in ntp's measured jitter