[ntp:questions] Timing issue with Linux and kernel PPS?

Miroslav Lichvar mlichvar at redhat.com
Tue Nov 20 11:12:58 UTC 2012

On Mon, Nov 19, 2012 at 06:03:06PM +0000, David Taylor wrote:
> On both systems, sudo modprobe pps_ldisc produces no output.

No message is a good message :).

> I have no idea which device ntpd is using, I simply have the type 22
> driver installed which, as I understood it, gets the accurate
> timestamp from the kernel. is /dev/pps0, is /dev/pps1, ...

> How the kernel chooses which device to
> use I don't know.

With udev the order might be random. There could be a race between the
script which loads modules from /etc/modules and udev.

> In /dev I see pps0 on the system without a PPS signal connected, and
> pps0 and pps1 on the system /with/ the PPS signal active.  On the
> system /with/ the signal active, some 25 seconds in the dmes output
> I see: pps_ldisc registered (so ldisc does matter, I stand
> corrected), followed by pps1 new source, and source /dev/ttyAMA0
> added.

You can see what pps device is actually generating events with:
grep '' /sys/class/pps/pps*/{assert,clear}

> So the issue appears to be that /dev/ttyAMA0 is not created until
> the GPS receiver is sending second pulses, and by that time ntpd is
> running and can't see the device.  Here are my lines from ntp.conf:
> # Kernel-mode PPS ref-clock for the precise seconds
> server minpoll 4 maxpoll 4
> fudge  flag3 1  refid PPS
> I wonder whether I should be using rather than .0?

Perhaps. Do you use in ntpd the serial output from the GPS with some
driver like NMEA?

If you don't need the pps from /dev/ttyACM0, my suggestion would be to
prevent loading of the pps_ldisc module, so there is always only one
pps device. Any chance you added a udev rule to load pps_ldisc
automatically when the serial device is created? 

Miroslav Lichvar

More information about the questions mailing list