Raspberry Pi GPS Locking

published 23.06.2019

For highly-accurate timekeeping or signal generation with a Raspberry Pi, it's possible to replace the on-board crystal with an external reference input. On the Raspberry Pi 1 the main system oscillator is a 19.2 MHz quarz crystal.

In order to be able to feed a square wave input signal (like the output from the GPS-reference or a u-blox NEO module), a (quick-and-dirty) low-pass filter was built. It uses 47pF C and 1┬ÁH L.
Software like WsprryPi and rpitx can be locked with this method as well.

Without the LPF, the Raspberry Pi seemed to run off some harmonic frequency from the square wave clock signal. The ACT led would still blink, network didn't come up and serial console output was unreadable. Measurements with a scope showed a UART frequency of ~210000 baud, but I wasn't able to decode any of that.

I've been running the Pi with ntpd against the servers of the PTB (National Metrology Institute of Germany), which is locked to their atomic clocks. So far the results look nice, I think I'm probably only measuring the jitter and latency of my internet connection.
munin graph

A more common approach is GPS synchronization via a 1 PPS signal over the GPIO pins. This can then be handled via a kernel module, but can only be used for timekeeping.