[LinuxPPS] PPS/ntpd fails on fresh startup

Luca Bertagnolio time at berta.com
Tue Oct 14 13:18:30 CEST 2008


With a stable machine, with nptd running OK, I stopped ntpd and tried
running this short script:

#!/bin/bash

ppsldisc /dev/ttyS1 &
sleep 3
killall ppsldisc
dmesg | tail -n 50


and got the following result:

source serial1 got cdev (253:0)
new PPS source serial1 at ID 0
PPS source #0 "/dev/ttyS1" added
PPS event on source 0 at 1223981405.999975777
capture assert seq #1 for source 0
PPS assert at 161048994 on source #0
PPS event on source 0 at 1223981406.199976391
capture clear seq #1 for source 0
PPS clear at 161049044 on source #0
PPS event on source 0 at 1223981406.999976335
capture assert seq #2 for source 0
PPS assert at 161049244 on source #0
PPS event on source 0 at 1223981407.199976951
capture clear seq #2 for source 0
PPS clear at 161049294 on source #0
PPS event on source 0 at 1223981407.999976058
capture assert seq #3 for source 0
PPS assert at 161049494 on source #0
PPS event on source 0 at 1223981408.199977510
capture clear seq #3 for source 0
PPS clear at 161049544 on source #0
PPS event on source 0 at 1223981408.999979968
capture assert seq #4 for source 0
PPS assert at 161049744 on source #0
PPS source #0 removed

so things seem OK to me, the source gets created and removed when ppsldisc runs,
and the 200ms is quite nicely aligned with the second.

Running the same script after a fresh reboot gives very similar results:

source serial1 got cdev (253:0)
new PPS source serial1 at ID 0
PPS source #0 "/dev/ttyS1" added
PPS event on source 0 at 1223981961.594073329
capture assert seq #1 for source 0
PPS assert at 4294963546 on source #0
PPS event on source 0 at 1223981961.794131992
capture clear seq #1 for source 0
PPS clear at 4294963596 on source #0
PPS event on source 0 at 1223981962.594364131
capture assert seq #2 for source 0
PPS assert at 4294963796 on source #0
PPS event on source 0 at 1223981962.794421957
capture clear seq #2 for source 0
PPS clear at 4294963846 on source #0
PPS event on source 0 at 1223981963.594653258
capture assert seq #3 for source 0
PPS assert at 4294964046 on source #0
PPS event on source 0 at 1223981963.794711921
capture clear seq #3 for source 0
PPS clear at 4294964096 on source #0
PPS source #0 removed

In this case, you can still see the 200ms PPS pulse though the internal
clock is not aligned with the second as in the previous log.

Now, since it's a fresh reboot and I want to start ntpd again, I launch the
script which says:

        killall ppsldisc
        /usr/local/sbin/ppsldisc /dev/ttyS1 &
        sleep 5

before launching ntpd, and what I get is the following:

source serial1 got cdev (253:0)
new PPS source serial1 at ID 0
PPS source #0 "/dev/ttyS1" added
PPS event on source 0 at 1223982501.750735386
capture assert seq #1 for source 0
PPS assert at 131289 on source #0
PPS event on source 0 at 1223982501.950794050
capture clear seq #1 for source 0
PPS clear at 131339 on source #0
PPS event on source 0 at 1223982502.751025351
capture assert seq #2 for source 0
PPS assert at 131539 on source #0
PPS event on source 0 at 1223982502.951084014
capture clear seq #2 for source 0
PPS clear at 131589 on source #0
PPS event on source 0 at 1223982503.751316153
capture assert seq #3 for source 0
PPS assert at 131789 on source #0
PPS event on source 0 at 1223982503.951374816
capture clear seq #3 for source 0
PPS clear at 131839 on source #0
PPS event on source 0 at 1223982504.751606117
capture assert seq #4 for source 0
PPS assert at 132039 on source #0
PPS event on source 0 at 1223982504.951664781
capture clear seq #4 for source 0
PPS clear at 132089 on source #0
PPS event on source 0 at 1223982505.751896082
capture assert seq #5 for source 0
PPS assert at 132289 on source #0
PPS event on source 0 at 1223982505.951954745
capture clear seq #5 for source 0
PPS clear at 132339 on source #0
PPS event on source 0 at 1223982506.752190236
capture assert seq #6 for source 0
PPS assert at 132539 on source #0
PPS event on source 0 at 1223982506.952248900
capture clear seq #6 for source 0
PPS clear at 132589 on source #0
PPS_GETCAP: source 0
PPS_SETPARAMS: source 0
PPS_GETCAP: source 0
PPS_SETPARAMS: source 0
PPS_FETCH: source 0
timeout 0.000000000
PPS_FETCH: source 0
timeout 0.000000000
PPS_FETCH: source 0
timeout 0.000000000
PPS_FETCH: source 0
timeout 0.000000000

with the last two lines going on forever.

Stopping and restarting ntpd the second time gives a very different result:

PPS source #0 removed
source serial1 got cdev (253:0)
new PPS source serial1 at ID 0
PPS source #0 "/dev/ttyS1" added
PPS event on source 0 at 1223982804.194687
capture assert seq #1 for source 0
PPS assert at 195808 on source #0
PPS event on source 0 at 1223982804.200196123
capture clear seq #1 for source 0
PPS clear at 195858 on source #0
PPS event on source 0 at 1223982805.195162
capture assert seq #2 for source 0
PPS assert at 196058 on source #0
PPS event on source 0 at 1223982805.200194922
capture clear seq #2 for source 0
PPS clear at 196108 on source #0
PPS event on source 0 at 1223982806.194799
capture assert seq #3 for source 0
PPS assert at 196308 on source #0
PPS event on source 0 at 1223982806.200195398
capture clear seq #3 for source 0
PPS clear at 196358 on source #0
PPS event on source 0 at 1223982807.194436
capture assert seq #4 for source 0
PPS assert at 196558 on source #0
PPS event on source 0 at 1223982807.200195035
capture clear seq #4 for source 0
PPS clear at 196608 on source #0
PPS event on source 0 at 1223982808.194074
capture assert seq #5 for source 0
PPS assert at 196808 on source #0
PPS event on source 0 at 1223982808.200194672
capture clear seq #5 for source 0
PPS clear at 196858 on source #0
PPS_GETCAP: source 0
PPS_SETPARAMS: source 0
PPS_GETCAP: source 0
PPS_SETPARAMS: source 0
PPS_FETCH: source 0
timeout 0.000000000
PPS_FETCH: source 0
timeout 0.000000000
PPS_FETCH: source 0
timeout 0.000000000
PPS_FETCH: source 0
timeout 0.000000000
PPS_FETCH: source 0
timeout 0.000000000
PPS event on source 0 at 1223982809.197062
capture assert seq #6 for source 0
PPS assert at 197058 on source #0
PPS_FETCH: source 0
timeout 0.000000000
PPS event on source 0 at 1223982809.200197660
capture clear seq #6 for source 0
PPS clear at 197108 on source #0
PPS event on source 0 at 1223982810.194186
capture assert seq #7 for source 0
PPS assert at 197308 on source #0
PPS_FETCH: source 0
timeout 0.000000000
PPS event on source 0 at 1223982810.200194784
capture clear seq #7 for source 0
PPS clear at 197358 on source #0
PPS event on source 0 at 1223982811.193823
capture assert seq #8 for source 0
PPS assert at 197558 on source #0
PPS_FETCH: source 0
timeout 0.000000000
PPS event on source 0 at 1223982808.604491679
capture clear seq #8 for source 0
PPS clear at 197608 on source #0

..and ntpd now works fine.

Looks like ntpd might have some initialization issues, maybe? BTW,
this happens with both a 4.2.4p4 and a 4.2.5p135 build.

Happy to do any test you believe might be useful.

Ciao, Luca

On Tue, Oct 14, 2008 at 10:04 AM, Rodolfo Giometti
<giometti at enneenne.com> wrote:
> On Mon, Oct 13, 2008 at 03:47:23PM +0200, Luca Bertagnolio wrote:
>> Rodolfo, when you have a minute can you comment on my issue?
>
> Hi. If you wish I replay sooner, please put my e-mail address in
> Cc. :)
>
>> Why would LinuxPPS fail at the first startup, and work the second time?
>
> I actually don't know why... but we have too much actors in this
> scene, we should try each part alone.
>
> If you don't use NTPD, can you see PPS signal arrive each time you
> create the PPS source?
>
> Another suggestion: as bluetooth devices do, try keeping ppsldisc
> alive until NTPD runs. You can copy the relevant code from your
> /etc/init.d/bluetooth init script when it manages the hciattach
> command.
>
> Let me know,
>
> Rodolfo
>
> --
>
> GNU/Linux Solutions                  e-mail: giometti at enneenne.com
> Linux Device Driver                          giometti at linux.it
> Embedded Systems                     phone:  +39 349 2432127
> UNIX programming                     skype:  rodolfo.giometti
>



More information about the LinuxPPS mailing list