gpsd-users
[Top][All Lists]
Advanced

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

Re: How to use PPS device other than /dev/pps0


From: Gary E. Miller
Subject: Re: How to use PPS device other than /dev/pps0
Date: Tue, 4 Jan 2022 10:29:09 -0800

Yo Adam!

On Tue, 4 Jan 2022 18:16:53 +1000
Adam Nielsen via <gpsd-users@nongnu.org> wrote:

> In the docs it says if /dev/ttyAMA0 is used for the GPS data,
> /dev/pps0 is opened automatically for PPS data.

Yup.  One of many cases in the doc.

> On my Raspberry Pi, the kernel PPS driver picks up /dev/ttyAMA0 as a
> serial port

Uh, no.  The Pi PPS driver knows nothing of ttyAMA0.  You have to tell it
which gpio pin to use.  Often 18 or 4.

> and makes its control signals available as /dev/pps0,
> which means the GPIO I'm using for the real PPS data gets bumped to
> /dev/pps1.

So you are using ttyAMA0 and another serial port?  The Pi only has
one serial port.

>  But sometimes when I boot,

Well, that is long before gpsd enters the picture.  A huge number
of ways for Pi boot to fail.

> the GPIO one registers first as
> /dev/pps0 and ttyAMA0 gets /dev/pps1 instead, so it's unpredictable.

Which makes no sense.

Please provide your /boot/config.txt, /boot cmdline.txt, and your
gpsd command line.

> To solve this I set up a udev rule to symlink the correct one to
> /dev/pps-gps, and then I launched gpsd with the parameters
> "/dev/ttyAMA0 /dev/pps-gps".

A pain, but if it works, why fix it?

> Everything looks fine and gpsmon is giving me PPS offset messages once
> a second.

gpsmon is not a tool to debug PPS.  RTFM.

> However when I link this up to ntpd via the SHM driver, it doesn't get
> any PPS data.

The propero tool, as root, is: ntpshmmon.


> Further investigation reveals that the SHM driver is
> using both /dev/pps0 and /dev/pps1:
> 
> 127.127.28.0 - GPS
> 127.127.28.1 - /dev/pps0
> 127.127.28.2 - /dev/pps1

Well, you set it up that way.  Send your ntp.conf and I'll show you.
OTOH, that should work just fine.

> The problem is that sometimes when I boot I should use /dev/pps0 and
> NTP has to use the .1 address, but other times when I boot I need to
> use /dev/pps1 and NTP has to be changed to the .2 address to work.

If you have ntpd reading both, it will pick the good one automagically.

> I
> don't want to leave both .1 and .2 enabled as then I always have a
> failed device in the list, which causes other issues with ntpd over
> time.

What other device could you possibly have on a PI that has one half-assed
serial port.

> It would seem that I need to be able to tell gpsd to only use
> /dev/pps-gps and to not open any other /dev/pps* devices.

But, you already did that above.

> This way I
> should be able to always use the .1 address for ntpd regardless of
> which actual device is in use, as gpsd would only ever be using one
> of the two PPS devices.

Don't worry about that.  Such a common problem tht gpsd and ntpd
handle it fine.

> How can I tell gpsd to only use the PPS device I specify and not to
> open any other PPS devices?

In what I THINK is your config, just disable the MAGIC_HAT build
option.  Or figure out where the second pps is common from and fix that.
I suspwect a bad udev rule.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        gem@rellim.com  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin

Attachment: pgpGa89vpkGEa.pgp
Description: OpenPGP digital signature


reply via email to

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