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

unruh unruh at invalid.ca
Wed Nov 21 18:17:08 UTC 2012


On 2012-11-21, David Taylor <david-taylor at blueyonder.co.uk.invalid> wrote:
> On 20/11/2012 11:12, Miroslav Lichvar wrote:
>> 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.
>>
>> 127.127.22.0 is /dev/pps0, 127.127.22.1 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 127.127.22.0 minpoll 4 maxpoll 4
>>> fudge 127.127.22.0  flag3 1  refid PPS
>>>
>>> I wonder whether I should be using 127.127.22.1 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?
>
> Thanks for your reply, Miroslav, but I don't even know what udev is, let 
> alone how to edit it!  Sorry, but you are way past my level now.

grep -r ldisc /etc/udev
should show you if udev is at any time trying to load pps_ldisc.
(Why it is called ldisc and why the underscore when the other one is
pps-parport I have no idea)
Anyway, look in /etc/modprobe.conf, /etc/modules.conf, /etc/modprobe.d/*
to see if pps_ldisc is loaded in any of those files. 
grep -r ldisc /etc/mod*

Note that it should not matter anyway since you also have to use
ldattach to attach the kernel interrupt to the pps_ldisc driver even if
pps_ldisc is loaded as a module. And the space penalty is not exactly
severe.




More information about the questions mailing list