[LinuxPPS] PPS/ntpd fails on fresh startup

William S. Brasher billb958 at door.net
Wed Oct 15 00:39:57 CEST 2008


On Tue, 14 Oct 2008, Rodolfo Giometti wrote:

> On Tue, Oct 14, 2008 at 02:00:38PM -0500, William S. Brasher wrote:
> 
> > /proc/interrupts shows interrupts are coming in.
> > 
> > cat < /dev/ttyS0 returns the NMEA sentence at once per second.
> 
> Everything happens while the PPS source is enabled? If so you should
> see the PPS events (see /sys/class/pps/ppsX/{assert,clear}).
>

/sys/class/pps/pps0/{assert,clear} are present but not changing.  See 
below for a description of what I did and the results I got.


 
> > Hmmmm.  I let ntpd configure the serial port after starting ppsldisc, 
> > which seems to squash the pps input.
> > 
> > Since I can receive the NMEA sentence from the port, and can in fact send 
> > serial data to the clock through the port, I assumed the port to be 
> > minimally configured.  Which says nothing about what ntpd may do to that 
> > port when it starts...
> > 
> > 
> > SO:  If I start ntpd in the startup script before I start ppsldisc,
> > everything works.   That is, I inserted the ntpd -gqx into the following 
> > script: 
> > 
> > case "$1" in
> >         start)
> >                 boot_mesg "Starting ntpd..."
> >                 /bin/setserial -v /dev/ttyS0 low_latency
> >                 sleep 2
> >                 ntpd -gqx 
> >                 sleep 2
> >                 /usr/bin/ppsldisc /dev/ttyS0 &
> >                 sleep 2
> >                 loadproc /usr/sbin/ntpd -g
> >                 sleep 2
> >                 killall ppsldisc
> >                 ;;
> 
> I'm puzzled! O_o
> 
> Luca, can you please test this settings too?
> 
> Ciao,
> 
> 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
> 
> 



And, what I did and saw at the command line.


Failing startup sequence:

Boot the system, and then

tara: # setserial -v /dev/ttyS0 low_latency
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4, Flags: low_latency

tara: # /usr/bin/ppsldisc /dev/ttyS0 &
[1] 2158

tara: # cat /sys/class/pps/pps0/{assert,clear}
1224022115.970380500#7
1224022116.070380780#7

tara: # ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1224022127.970357708, sequence: 19 - clear  1224022127.070359268, sequence: 18
source 0 - assert 1224022127.970357708, sequence: 19 - clear  1224022128.070357313, sequence: 19
^C

tara: # /usr/sbin/ntpd -g

tara: # cat /sys/class/pps/pps0/{assert,clear}
1224022143.970325302#35
1224022143.070327700#34

(Wait a bit... assert, clear are not changing)
tara: # cat /sys/class/pps/pps0/{assert,clear}
1224022143.970325302#35
1224022143.070327700#34

tara: # ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
time_pps_fetch() error -1 (Connection timed out)
^C



Successful startup sequence:

Boot the system...

tara: # setserial -v /dev/ttyS0 low_latency
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4, Flags: low_latency

tara: # ntpd -gqx
ntpd: time slew +0.067051s

tara: # /usr/bin/ppsldisc /dev/ttyS0 &
[1] 2160

tara: # cat /sys/class/pps/pps0/{assert,clear}
1224022643.945933682#8
1224022644.045984474#8

tara: # ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1224022652.950437771, sequence: 17 - clear  1224022652.049995336, sequence: 16
source 0 - assert 1224022652.950437771, sequence: 17 - clear  1224022653.050487610, sequence: 17
^C

tara: # /usr/sbin/ntpd -g

tara: # cat /sys/class/pps/pps0/{assert,clear}
1224022668.958442888#33
1224022669.058493122#33

(Wait a bit, note assert, clear are changing)
tara: # cat /sys/class/pps/pps0/{assert,clear}
1224022672.960444126#37
1224022673.060495565#37

tara: # ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1224022678.963678367, sequence: 43 - clear  1224022678.063192657, sequence: 42
source 0 - assert 1224022678.963678367, sequence: 43 - clear  1224022679.063731799, sequence: 43
^C

tara: # killall ppsldisc
[1]+  Terminated              /usr/bin/ppsldisc /dev/ttyS0

tara: # cat /sys/class/pps/pps0/{assert,clear}
1224022708.979834182#73
1224022709.079887782#73

(Wait a bit, note assert, clear are changing)
tara: # cat /sys/class/pps/pps0/{assert,clear}
1224022711.981448039#76
1224022712.081501628#76

tara: # ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1224022717.984674762, sequence: 82 - clear  1224022717.084190636, sequence: 81
source 0 - assert 1224022717.984674762, sequence: 82 - clear  1224022718.084728049, sequence: 82
^C


tara: # ntptime
ntp_gettime() returns code 0 (OK)
  time cc9f9d20.cd7880d0  Tue, Oct 14 2008 17:35:12.802, (.802620444),
  maximum error 7155 us, estimated error 421 us, TAI offset 0
ntp_adjtime() returns code 0 (OK)
  modes 0x0 (),
  offset -72.204 us, frequency 1.533 ppm, interval 1 s,
  maximum error 7155 us, estimated error 421 us,
  status 0x2001 (PLL,NANO),
  time constant 4, precision 0.001 us, tolerance 500 ppm,





More information about the LinuxPPS mailing list