Pi - BYO-NTP/recipes GitHub Wiki

Raspberry Pi

Model Info

cat /sys/firmware/devicetree/base/model

Optimization

Ambient Temperature

There's plenty of anecdotal evidence that temperature can play a role in the precision of a well-configured NTP server. My homelab is in an earth-coupled basement where the temperature is very stable with one exception: once or twice a day the cooling dehumidifier (aka: heat pump water heater) located 20' away kicks on. The change in air temperature is visible as the dip in the CPU graph below.

In the tests I've run, the difference is mild, as in: if the precision is 4 µs and one cared about getting it to 3 µs, temperature control could make that difference.

CPU speed

The default CPU governer on the Pi 4 and Pi 5 with Pi OS 12 is ondemand. Quite a few build recipes suggest switching it to performance. In my testing, it did make a small improvement:

graph of NTP server accuracy with CPU governers ondemand, performance, and powersave

The biggest difference is that performance boosted the CPU temperature from 42ºC to 52ºC by locking the CPU frequency at 2.4GHz. It also improved my accuracy from 4 µs to 3 µs during a 12-hour measurement window, by avoiding the occasional oscillations that went 1 µs wider. This aroused my curiosity so I also tested powersave: the CPU ran 10ºC cooler (longer lasting) and it avoided those wider oscillations. It seems that it's the CPU frequency variation that is affecting precision.

nohz=off

  • this config option made no difference at all for me.

UARTs

UART is fancy term for a serial port. In the olden days, we used serial ports to connect to modems and get on the internet.

and settings for them

UART Pi 4 Pi 5 /dev/____ Overlays
UART0 PL011 PL011 ttyAMA0 uart0
UART1 mini UART (ttyS0) PL011 uart1
UART2 PL011 PL011 uart2
UART3 PL011 PL011 uart3
UART4 PL011 PL011 uart4
UART5 PL011 uart5
USB serial ttyACM0
Primary/console UART1 ttyAMA10 serial0
Secondary/BT UART0 serial1

Settings

  • miniuart-bt: Switches Bluetooth to mini UART, makes UART0 the primary. DONT use unless you need bluetooth.
  • disable-bt: Disables Bluetooth, makes UART0 the primary. Use with systemctl disable hciuart
  • enable_uart: Default values for Pi 4 (0) and Pi 5 (1)

References

⚠️ **GitHub.com Fallback** ⚠️