[LinuxPPS] Timeouts from time_pps_fetch() after a few minutes

Jakob Stoklund Olesen stoklund at 2pi.dk
Sat Dec 30 20:34:08 CET 2023


Hi,

I have a GPS connected to an RS-232 port with a PPS signal on the DCD line. The polarity and duty cycle is such that DCD is asserted for 900 ms and deasserted for 100 ms.

LinuxPPS is able to timestamp both edges of this signal for a while, but after a few minutes it stops, and I just get timeouts from time_pps_fetch(). Any tips for troubleshooting this behavior would be appreciated.

I see this behavior both with gpsd and chrony, but the simplest way of reproducing it is using the pps-tools binaries:


lake# ppsldisc /dev/ttyS0 &; ppstest /dev/pps1           
[1] 8486
trying PPS source "/dev/pps1"
found PPS source "/dev/pps1"
ok, found 1 source(s), now start fetching data...
source 0 - assert 0.000000000, sequence: 0 - clear  1703961271.992741856, sequence: 1
source 0 - assert 1703961272.092740508, sequence: 1 - clear  1703961271.992741856, sequence: 1
source 0 - assert 1703961272.092740508, sequence: 1 - clear  1703961272.992754266, sequence: 2
source 0 - assert 1703961273.092753433, sequence: 2 - clear  1703961272.992754266, sequence: 2
source 0 - assert 1703961273.092753433, sequence: 2 - clear  1703961273.992764077, sequence: 3
...
source 0 - assert 1703961291.092948218, sequence: 20 - clear  1703961290.992955067, sequence: 20
source 0 - assert 1703961291.092948218, sequence: 20 - clear  1703961291.992957591, sequence: 21
source 0 - assert 1703961292.092963462, sequence: 21 - clear  1703961291.992957591, sequence: 21
source 0 - assert 1703961292.092963462, sequence: 21 - clear  1703961292.992967672, sequence: 22
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)
^C
lake# ppstest /dev/pps1
trying PPS source "/dev/pps1"
found PPS source "/dev/pps1"
ok, found 1 source(s), now start fetching data...
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)
^C


As you can see, once the timeouts begin, restarting the ppstest program doesn’t help. However, restarting ppsldisc fixes the problem every time:

lake# fg
[1]  + running    ppsldisc /dev/ttyS0
^C
lake# ppstest /dev/pps1
trying PPS source "/dev/pps1"
unable to open device "/dev/pps1" (No such file or directory)
lake# ppsldisc /dev/ttyS0 &; ppstest /dev/pps1
[1] 8529
trying PPS source "/dev/pps1"
found PPS source "/dev/pps1"
ok, found 1 source(s), now start fetching data...
source 0 - assert 0.000000000, sequence: 0 - clear  1703961363.994067181, sequence: 1
source 0 - assert 1703961364.094075396, sequence: 1 - clear  1703961363.994067181, sequence: 1
source 0 - assert 1703961364.094075396, sequence: 1 - clear  1703961364.994103793, sequence: 2
source 0 - assert 1703961365.094107829, sequence: 2 - clear  1703961364.994103793, sequence: 2
source 0 - assert 1703961365.094107829, sequence: 2 - clear  1703961365.994115424, sequence: 3
...
source 0 - assert 1703961844.101882095, sequence: 481 - clear  1703961844.001889937, sequence: 481
source 0 - assert 1703961844.101882095, sequence: 481 - clear  1703961845.001892238, sequence: 482
source 0 - assert 1703961845.101892068, sequence: 482 - clear  1703961845.001892238, sequence: 482
source 0 - assert 1703961845.101892068, sequence: 482 - clear  1703961846.001896410, sequence: 483
time_pps_fetch() error -1 (Connection timed out)


That time it ran for 8 minutes before the timeouts began. It seems to vary from tens of seconds to several minutes before it stalls. (The timestamps are drifting because ntpsec was restarted recently. It is not configured with any refclock, just public servers.)

My serial port controller is built in to the motherboard:

[  +0.000094] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[  +0.000664] 00:01: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A

The /dev/pps0 device is associated with ptp0. I assume that is an IEEE-1588 feature in my built-in ethernet adapter. I haven’t tried using it:

lake# ppsfind .
pps0: name=ptp0 path=
pps1: name=serial0 path=/dev/ttyS0

I’m running Debian 12.4 on an Intel i7-13700K:

lake# uname -a
Linux lake 6.1.0-16-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.67-1 (2023-12-12) x86_64 GNU/Linux
lake# apt info pps-tools
Package: pps-tools
Version: 1.0.2-2
Priority: optional
Section: devel
Maintainer: Bernd Zeimetz <bzed at debian.org>
Installed-Size: 90.1 kB
Depends: libc6 (>= 2.4)
Homepage: https://github.com/redlab-i/pps-tools
Download-Size: 13.3 kB
APT-Manual-Installed: yes
APT-Sources: http://deb.debian.org/debian bookworm/main amd64 Packages
Description: LinuxPPS support tools and headers
 This package includes the necessary headers for using LinuxPPS PPSAPI
 kernel interface in user-space applications and several support tools:
  * ppstest: PPSAPI interface tester
  * ppsldisc: setup correct RS232 line discipline
  * ppswatch: continuously print PPS timestamps
  * ppsctl: PPS device manager
  * ppsfind: find pps device by name


Thanks,
Jakob





More information about the discussions mailing list