[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-users] 1PPS on the Pi - let's pool our knowledge.

From: Eric S. Raymond
Subject: [gpsd-users] 1PPS on the Pi - let's pool our knowledge.
Date: Tue, 19 Apr 2016 13:47:15 -0400 (EDT)

(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:

You will need to dig deeper to make the PPS work, here is a good reference:

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 

   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
    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
    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="";>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),

reply via email to

[Prev in Thread] Current Thread [Next in Thread]