domschl / RaspberryNtpServer

Stratum-1 time server with Raspberry Pi and GPS
MIT License
88 stars 5 forks source link

Offset value of 0.0 prevents usage of GPS #1

Closed cvonderstein closed 1 year ago

cvonderstein commented 1 year ago

Hey,

as written in the title, the offset value of 0.0 for the GPS refclock stored in /etc/chrony/chrony.conf (which seems to be the newer path for the config) prevents the usage of GPS as reference time. The same was discussed here.

Setting it to 0.1 fixed it, I'm not sure if that breaks something or lowers the accuracy, but afterwards it at least worked for me. Maybe you want to include this in your Readme?

Addition after writing this: I saw that you mentioned correcting the offset in the config later, but for me the problem was that the GPS didn't get selected as reference clock in the first place (as it should have been as described in https://github.com/domschl/RaspberryNtpServer#setting-up-chrony-as-time-server), and the Last sample shown for PPS was always 0. The linked section is where I got stuck, and I didn't even get to the point of having GPS selected as the main time source.

Also, while we're at it, it would be nice to have the corresponding udev rules included (as figuring out how to do it when you've never worked with them before is quite pain). Just as quick reference (if you want to copy it): /etc/udev/rules.d/pps-sources.rules should contain

KERNEL=="pps0", OWNER="root", GROUP="_chrony", MODE="0660"
KERNEL=="ttyS0", RUN+="/bin/setserial -v /dev/%k low_latency irq 4"

This assumes the user of the chronyd process to be _chrony, which can be found out using ps aux | grep chronyd. Also, I'm using the serial connection here, otherwise ttyS0 probably needs to be changed. To reload udev rules without reboot, run

sudo udevadm control --reload-rules && sudo udevadm trigger

Both cost me quite some time figuring out, so I would be happy if you include both improvements in your Readme File.

domschl commented 1 year ago

Thank you for this additional information! I'll update the docs.

The refclock behavior seems to be something with recent chrony versions. I'll have to check that. Thanks for the udev research!

(I'll update this, once the modifications are done.)