Hacker News new | ask | show | jobs
by geerlingguy 7 days ago
It all depends on the gains you're looking for. Almost any solution with PPS input can get you under 1µs, even on Linux through GPIO.

If you want to chase lower, you need a hardware-disciplined clock. Either through FPGA, or in the case of my Time Pi, I have a PTP NIC with a PHC disciplined from the ublox F9T—which should be within 5-20ns of GPS time. This can be measured on higher-end boards like the TimeHAT by comparing PPS out from the GNSS module, PPS from the NIC, and PPS from a separate GPSDO, along with a timestamp comparison tool like the tinyGTC or TAPR TICC: https://tapr.org/product/tapr-ticc/

The annoying thing is there are few PC hardware combos that include the relevant PPS and frequency outputs to allow actual verification of your time in hardware. Software can show numbers but even on my Pi dashboard, the sub-20ns sync reported is between the system clock and the NIC PHC... but not currently accounting for the delay when the kernel reads the PHC over PCIe.

Pi could support PTM on its PCIe bus, that would be awesome. Overkill for 99.9% of its market though!

1 comments

Poul-Henning Kamp has proven that you can get down into the nanoseconds range, mostly just by using the right software. If you work at it hard enough.

In 2002, he got the error band down to 260 nanoseconds, see: https://phk.freebsd.dk/soekris/pps/

He has done better since then.

My Time Pi setup is in the single-digit ns range, on the hardware side—the PPS from GPS goes into the NIC's PHC, and disciplines that clock on the HAT. That time is distributed with hardware timestamping over the network (PTP), and other devices can get hardware level sync sub-10ns.

The Pi still has to handle its own PPS through interrupts, and without PTM, that means "less than a microsecond" is about as good as I can currently say _in Linux_ on the Pi.

Most people who get serious about timing in the ns (and now sub-ns) range move to FPGAs now, especially considering how inexpensive they've become. I haven't made that jump but most of my actual timing-focused hardware runs on an FPGA inside (like the NetTimeLogic PPS analyzer I have all my clocks plugged into).

Yeah, I agree — hardware is the way to really get down to the nanoseconds. Meinberg has proven that. As have other hardware vendors.

But PHK has done it in just software, running on a Soekris board. And he has done better since then, again just with software.