[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] [gpsd-users] 1PPS on the Pi - let's pool our knowledge.
From: |
Fred Hillhouse |
Subject: |
Re: [gpsd-dev] [gpsd-users] 1PPS on the Pi - let's pool our knowledge. |
Date: |
Tue, 19 Apr 2016 14:29:28 -0400 |
The IO pinout:
3V3 1 2 5V
GPIO2 3 4 5V
GPIO3 5 6 GND
GPIO4 7 8 GPIO14
GND 9 10 GPIO15
GPIO17 11 12 GPIO18
GPIO27 13 14 GND
GPIO22 15 16 GPIO23
3V3 17 18 GPIO24
GPIO10 19 20 GND
GPIO9 21 22 GPIO25
GPIO11 23 24 GPIO8
GND 25 26 GPIO7
ID_SD 27 28 ID_SC
GPIO5 29 30 GND
GPIO6 31 32 GPIO12
GPIO13 33 34 GND
GPIO19 35 36 GPIO16
GPIO26 37 38 GPIO20
GND 39 40 GPIO21
-----Original Message-----
From: gpsd-users
[mailto:address@hidden On Behalf Of
Eric S. Raymond
Sent: Tuesday, April 19, 2016 1:47 PM
To: address@hidden; address@hidden; Frank Nicholas; Mark Atwood;
Phil Salkie
Subject: [gpsd-users] 1PPS on the Pi - let's pool our knowledge.
(Resend, I typoed an address. Ignore if you;ve already see it.)
The next logical thing to add to the draft HOWTO is a description of
how to configure the Pi+HAT so that 1PPS is visible to our test programs -
I'm
thinking mainly of gpsmon, ppstest, and GPSD's contrib/ppscheck. This
seems like a good preparatory step for making it visible to NTPsec.
The sources on this are somewhat confusing. Our INSTALL file has these
words, written I think by Gary Miller:
--------------------------------------------------------------------------
A very popular option is to install the AdaFruit Ultimate GPS HAT. With
this GPS you also get a good 1PPS signal. This works as any other GPS
with gpsd, but there are two things to note. The GPS takes over the
serial console: /dev/ttyAMA0. The PPS signal will be on GPIO Pin #4.
Only two specific changes need to be made to make the HAT work. First
in the file /boot/cmdline.txt, remove this part "console=ttyAMA0,115200
kgdboc=ttyAMA0,115200)". That frees the serial port from console use so
the GPS can use it.
Second you need to tell the boot process to load the pps_gpio module
and attach /dev/pps0 to GPIO pin 4. Do that by adding this line
to the bottom of /boot/config.txt: dtoverlay=pps-gpio,gpiopin=4
Reboot and proceed as for any other operating system to use gpsd.
Warning, the pps_gpio driver in all linux kernels up to the current
3.19 only reports one edge. Be sure to validate that your PPS signal
is not offset by the pulse width.
Detailed instructions are available from their web site:
https://learn.adafruit.com/adafruit-ultimate-gps-hat-for-raspberry-pi/
You will need to dig deeper to make the PPS work, here is a good reference:
http://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html
--------------------------------------------------------------------------
Most of the above is now redundant with the draft HOWTO I'm working on.
Evidently there are two steps: (1) Specifying the GPIO pin, and (2)
ensuring that the pps-gpio module is loaded.
Since /dev/pps0 is referred to, I gather that doing this and rebooting
should enable an RFC2783-style kernel PPS interface watching the GPIO
pin. One of the experts should explicitly confirm or correct me if
I'm wrong about this, because it affects the explanation I'll write
for the HOWTO.
gpsd and gpsmon can use an RFC2783-style PPS interface. GPSD's
config/ppscheck cannot; instead it relies on a Linux-specific ioctl
that watches handshake lines on the serial device.
Gary refers to GPIO pin 4. His "dig deeper" source is David Taylor's,
which says GPIO pin 18. Examining the traces on my Pi 3 causes me to
suspect that it uses pin 4. Did this vary by Pi model? If so, we
need to be quite clear about which pin it is on which Pi.
There's also an issue with the syntax of the GPIO option being
variable by kernel version. David J. Taylor has this to say:
--------------------------------------------------------------------------
Raspbian versions around February 2015
After updating another Raspberry Pi to the most recent Raspbian - for
a new Raspberry Pi 2 which I had purchased - I discovered that things
had changed once again. These details from my quick-start page.
Linux versions: 3.18.6+ 3.18.7-v7
$ sudo nano /boot/config.txt - Add dtoverlay=pps-gpio,gpiopin=18 on a new
line.
If you previously added bcm2708.pps_gpio_pin=18 to the end of
cmdline.txt, remove it. Save and close.
$ sudo nano /etc/modules - Add pps-gpio on a new line.
Save, close & reboot.
Now proceed to check that PPS is working.
Raspbian versions around November 2014
There are two steps required to enable PPS on the GPIO port, one to
tell the kernel to include the support, and one to actually cause the
support module to be loaded. First, tell the kernel that GPIO pin 18
is to be used. This enables the PPS-GPIO support in the kernel. Add
this text to the /boot/cmdline.txt file:
$ sudo nano /boot/cmdline.txt
add:
bcm2708.pps_gpio_pin=18
to the end of the line.
It must be on the same line, not on a new line, as Ray Hunter found out!
Next, you need to tell the kernel to load the module which provides
this support. Quite why this can't be automatic I don't know! Add
the module name to the end of the file /etc/modules.
$ sudo nano /etc/modules
add:
pps-gpio
at the end if the list, and reboot.
--------------------------------------------------------------------------
Gary's advice is not referred to a dated Raspbian version, and he
doesn't mention adding pps-gpio to /etc/modules.
I tried building contrib/ppscheck on the Pi 3 and running it on /dev/ttyAMA0
and saw no line transitions.
John Brase said:
> I've been able to get [1PPS] with ppstest, but not with gpsd.
That might just mean the Raspbian package of gpsd is misconfgured.
I haven't done a source build of gpsd on the Pi yet; that's on
my to-do list.
We need to assemble a correct description of all this for the HOWTO.
I'm not content to bash together a recipe that only works once and
by semi-accident.
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
"...quemadmodum gladius neminem occidit, occidentis telum est."
[...a sword never kills anybody; it's a tool in the killer's hand.]
-- (Lucius Annaeus) Seneca "the Younger" (ca. 4 BC-65 AD),
- Re: [gpsd-dev] [gpsd-users] 1PPS on the Pi - let's pool our knowledge., (continued)
- [gpsd-dev] Raspberry Pi progress, Eric S. Raymond, 2016/04/20
- Re: [gpsd-dev] Raspberry Pi progress, Gary E. Miller, 2016/04/20
- Re: [gpsd-dev] Raspberry Pi progress, Eric S. Raymond, 2016/04/20
- Re: [gpsd-dev] Raspberry Pi progress, Gary E. Miller, 2016/04/20
- Re: [gpsd-dev] Raspberry Pi progress, Eric S. Raymond, 2016/04/20
- Re: [gpsd-dev] Raspberry Pi progress, Gary E. Miller, 2016/04/20
- Re: [gpsd-dev] Raspberry Pi progress, Gary E. Miller, 2016/04/20
Re: [gpsd-dev] [gpsd-users] 1PPS on the Pi - let's pool our knowledge.,
Fred Hillhouse <=
Re: [gpsd-dev] [gpsd-users] 1PPS on the Pi - let's pool our knowledge., Jon Brase, 2016/04/20
Re: [gpsd-dev] [gpsd-users] 1PPS on the Pi - let's pool our knowledge., David J Taylor, 2016/04/20
- Re: [gpsd-dev] [gpsd-users] 1PPS on the Pi - let's pool our knowledge., Hal Murray, 2016/04/20
- Re: [gpsd-dev] [gpsd-users] 1PPS on the Pi - let's pool our knowledge., Eric S. Raymond, 2016/04/20
- Re: [gpsd-dev] [gpsd-users] 1PPS on the Pi - let's pool our knowledge., Pete Nevill, 2016/04/20
- Re: [gpsd-dev] [gpsd-users] 1PPS on the Pi - let's pool our knowledge., David J Taylor, 2016/04/20
- Re: [gpsd-dev] [gpsd-users] 1PPS on the Pi - let's pool our knowledge., Eric S. Raymond, 2016/04/20
Re: [gpsd-dev] [gpsd-users] 1PPS on the Pi - let's pool our knowledge., Eric S. Raymond, 2016/04/20