macOS Stratum 1 [sub-1us PPS]

I’m working on a sensor project with a Mac Mini at the center and was looking for a GPS PPS solution to get chrony down into the single microsecond range for distributed log correlation.

I expected this to be easy, but after digging for a compatible receiver turns out it’s not easy at all on a Mac. After a lot of digging and experimenting, I was able to find the buried USB Start of Frame (SOF) timers and correlate them with a 32Hz USB TFA stream.

Long story short, chrony locks below 1us with a median RMS of 129ns and a max of 1.3us (filterable) via a virtual PPS chrony adapter. Any Nordic nRF52 with GNSS will work and it should be easy to expand to ESP32 boards yet I have not tested the ESP32 as a USB TX yet. There’s a direct connect firmware and a shared BLE streaming solution on the GitHub. It also turns the board into a fully support GNSS receiver, not just PPS.

I’m considering an adapter for a Pi5 to test the USB option, or if anyone knows an nRF/ESP32 HAT it’s trivial to enable a GPIO out 1PPS, 10Hz etc. I’m also planning a dedicated NTP/PTP server on the upcoming ESP32-S31 board with gigabit Ethernet all-in-one and expect some PPS wired board to hit the scene at some point. Going forward I expect these to make very good time servers. Much cheaper than the Pi, yet likely not as scalable.

There’s some other time transfer work between MCUs in the repo if you’re interested in sub-1us synchronization over the air as well.

Let me know if I can help, and I’m looking to hone in on just the right NTP/PTP Pi solution yet have not found it.

So… there’s something interesting that I have yet to test, but is extremely promising for macOS external time sync. USB 3.2 has a mechanism that can be used on iOS and I believe also macOS for ‘genlock’, which is currently used by some video hardware (BlackMagic, mainly) for frame sync, but isn’t really that exposed in public interfaces.

But this project by the Time Appliances Project uses MIDI and/or genlock to send in a fairly accurate 1PPS signal, and should work with PTP and/or GPS PPS input: GitHub - Time-Appliances-Project/TimeStick · GitHub

I will be testing this soon and hope to publish a video (or at least blog post) about it…

It would certainly be more accurate than ‘hope’ which is how I sent in timestamps from a USB GPS module on my Mac mini a few months back: Using GPS for the most accurate time possible on a Mac - Jeff Geerling

Edit: And I’d also love to have a good ESP32 option, the most annoying thing there is deciphering the maze of different variants!

IIRC, Genlock uses a spare USB pin to serve as the PPS and requires special drivers on both sides. The Start of Frame tricks above worked in user-mode, yet I’m sure there’s a way to unlock the genlock driver.

It looks like the new Time Stick 3 will support USB time transfer to the Mac, yet it’s unclear how accurate as they seem focused on the Ethernet clock. I repeated the SOF USB tricks on a Raspberry Pi and the results were shockingly close to a GPIO pin tied to a hardware timer with a dedicated CPU core.

The Nordic nRF52 is superior to the ESP32(S3) for timing. Everything is natively hardware timestamped (RF and USB) and the upcoming nRF54 has a tunable quartz crystal. The Heltec T096 (L1/L5) and T112 (L1 only) both come integrated with GNSS and PPS for under $40.

The upcoming ESP32-S31 supports gigabit ethernet and PTP timestamps natively, which should make it competitive with the Pi.

Looking forward to the video and I still read your blog! Thanks Jeff.