What system tweaks improve ntp synchronisation?

Hi,

I’ve got a u-blox timing gps connected to a raspberry pi. Now I would like it to be as accurate as possible of course. Currently it does this: https://gateway.vanheusden.com/ntp/plot-reference-pps-offsets

What system tweaks could help?

Like:

  • real time kernel
  • dynamic tick off
  • 100 Hz interrupt (instead of 250 Hz)
  • preemtible kernel
1 Like

My short answer is that I’m impressed that your setup is as tight as it is. USB is an inherently jittery. Even though we have expected timing improvements from USB 1, to USB 2, to USB 3.0, 3.1, 3.2, and now 4 and 5, we don’t have lots of (or any, really) data that shows the differences between them. What about PPS signals? Over USB or “direct”?

My guess at reading the graph you publish is that a significant number of the data points you have are at better than 100 microseconds. That’s good.

I think the best answer is that the more data people can collect and share, the better we can do at leveraging the information and identifying useful places to “look next”.

It should be especially illuminating if somebody tries to duplicate what anybody else has done, and they get significantly different results. That opens the door to “drilling down” and identifying “significant components and considerations” of a setup.

Thoughts?

1 Like

Hi Harlan,

The device is not corrected via USB (only for power), but directly via GPIO pins. PPS is connected to a GPIO-pin which is monitored by the linux kernel pps-driver.

Regarding the tweaks: I’m planning to setup two pi’s connected to the same GPS-PPS. Then one with the tweaks and one without.
I’m also considering putting https://nl.aliexpress.com/item/32993669471.html?spm=a2g0o.order_list.order_list_main.178.533b1802KXDkXa&gatewayAdapt=glo2nld (the 60 degrees celsius, 5 volt) against the crystal of the raspberry. Considering as I’m afraid things will break (either the pi or the powersupply feeding the heater).
Lastly I also want to check if it helps to lower and fixate the cpu clock frequency to a certain value.

I have a number of PI (Models 3,4 and 5) with ublox receivers connected to GPIOs using NTPv4 NMEA and PPS drivers. I haven’t tweeked the kernels at all, but get 2-4us PPS offests provided that I do not use them for general computing tasks. Contrast that with a small NTP server I have which has a Ublox NEO-6M (not timing grade) receiver tightly coupled to an STM32F1 MCU on the same circuit board. It reports PPS offsets less than 200ns over 24hrs. So the way to go is bare metal.

1 Like

I totally agree about bare metal altough i find it to be fun to get the maximum out of a regular pi as well :slight_smile:

I made a thing where I monitor several time sources compared to my pi + timing setup so ideally the monitoring pi is as accurate as possible: https://gateway.vanheusden.com/ntp/ (it is slow because it runs on a pi).

Glad to hear about the GPIO pins.

I think the best thing to do is to experiment, analyze, refine the experiment, … and repeat. Publish all these results.

I’m happy to do what I can to help.