[ntp:questions] double pps device

Brian Inglis Brian.Inglis at SystematicSw.ab.ca
Sat Nov 12 16:13:26 UTC 2016


On 2016-11-12 08:04, folkert wrote:
> Hoping that this is the right list for this question.
>
> Before I used my rpi-gpio-ntpd program. As I would like better latency
> values, I'm going to try to use the kernel pps interface. This is all on
> a raspberry pi.
> Now I hit my head on the following.
>
> When my system is running no ntpd and no gpsd, there is a /dev/pps0
> device. This is strange. In fact, that's the one seeing timestamp updates in the
> assert-file under /sys.
> I verified that no program has /dev/ttyAMA0 open (serial port on the
> rpi).

That's the first prereq for running a serial GPS on the system;
second is you also have systemd or getty tty service disabled
on that port; in /boot/config.txt you have:
	# add pps
	dtoverlay=pps-gpio,gpiopin=4
in /etc/modules you have:
	pps-gpio
at startup you should see:
	pps_core: LinuxPPS API ver. 1 registered
	pps_core: Software ver. 5.3.6 - Copyright 2005-2007 ...
	pps pps0: new PPS source pps.-1
	pps pps0: Registered IRQ 170 as PPS source
	Modules linked in: ... pps_gpio pps_core ...
and if you have a serial GPS with PPS hooked up and running,
you'll see:
$ head /sys/devices/platform/pps/power/*
==> /sys/devices/platform/pps/power/autosuspend_delay_ms <==
head: error reading "/sys/devices/platform/pps/power/autosuspend_delay_ms": Input/output error

==> /sys/devices/platform/pps/power/control <==
auto

==> /sys/devices/platform/pps/power/runtime_active_time <==
0

==> /sys/devices/platform/pps/power/runtime_status <==
unsupported

==> /sys/devices/platform/pps/power/runtime_suspended_time <==
0
$ head /sys/devices/virtual/pps/pps0/*
==> /sys/devices/virtual/pps/pps0/assert <==
1478964894.999998692#3920613

==> /sys/devices/virtual/pps/pps0/clear <==

==> /sys/devices/virtual/pps/pps0/dev <==
245:0

==> /sys/devices/virtual/pps/pps0/echo <==
1

==> /sys/devices/virtual/pps/pps0/mode <==
1151

==> /sys/devices/virtual/pps/pps0/name <==
pps.-1

==> /sys/devices/virtual/pps/pps0/path <==


==> /sys/devices/virtual/pps/pps0/power <==
head: error reading "/sys/devices/virtual/pps/pps0/power": Is a directory

==> /sys/devices/virtual/pps/pps0/subsystem <==
head: error reading "/sys/devices/virtual/pps/pps0/subsystem": Is a directory

==> /sys/devices/virtual/pps/pps0/uevent <==
MAJOR=245
MINOR=0
DEVNAME=pps0

Did you also setup PPS and GPS symlinks in udev e.g.
create /etc/udev/rules.d/99-gps-pps.rules:
	KERNEL=="pps0",SYMLINK+="gpspps0"
	KERNEL=="ttyAMA0", SYMLINK+="gps0"
run:
	$ sudo udevadm trigger
to create symlinks /dev/gps0 and /dev/gpspps0.
Check what's there and how it's set up with:
	$ ls -l /dev/?ps*
all you should see is, reflecting the last startup date/time:
lrwxrwxrwx 1 root root      7 Sep 27 22:43 /dev/gps0 -> ttyAMA0
lrwxrwxrwx 1 root root      4 Sep 27 22:43 /dev/gpspps0 -> pps0
crw------- 1 root root 245, 0 Sep 27 22:43 /dev/pps0

> If I now start gpsd, then suddenly a /dev/pps1 appears. This device
> is NOT the real pps device. Also the timestamp of the assert-file
> does not change for pps1. gpsd is also opening that file. Result of
> course is that things are not keeping track of correct time.
>
> Do you have any idea what could be the cause? I updated cmdline.txt,
> inittab, systemd, etc etc to not use the serial port and none is
> (apart from gpsd) which I verified with lsof

Did you start gpsd with:
	$ sudo gpsd /dev/ttyAMA0 -F /var/run/gpsd.sock
which runs it against the GPS device on /dev/ttyAMA0 port?
If you did not, maybe it's trying to be "smart" and detect and set
stuff up for you.
In man gpsd and on http://www.catb.org/gpsd/gpsd.html it says:
"On Linux systems supporting udev, gpsd is normally started
automatically when a USB plugin event fires (if it is not already
running) and is handed the name of the newly active device. In that
case no invocation is required at all."
And under FILES /dev/ttyS0:
"Prototype TTY device. After startup, gpsd sets its group ID to the
owning group of this device if no GPS device was specified on the
command line does not exist." [sic]
Do you see anything relevant from dmesg that could be causing
gpsd to do it's own setup?
See also:
	/usr/share/doc/gpsd/TROUBLESHOOTING.gz
and
	http://www.catb.org/gpsd/faq.html

I must admit I ran gpsd just long enough to validate PNT functions
and data were working properly, and tried out a few sat display
programs, before I shut it down and setup PPS as above.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada


More information about the questions mailing list