[Top][All Lists]

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

Re: [gpsd-users] gpsd interfacing to Raspberry PI

From: Gary E. Miller
Subject: Re: [gpsd-users] gpsd interfacing to Raspberry PI
Date: Tue, 14 May 2019 09:42:20 -0700

Yo Thomas!

On Wed, 8 May 2019 13:42:14 +0200
Thomas Schweikle <address@hidden> wrote:

> Configuration:
> - Raspberry PI HAT based on SIM868 set to communicate with GPIO
> serial port
> - Raspberry PI 2B+ GPIO set to serial, no console 8N1 at 115200baud

Wow, never heard of the SIM868.  I see it has no binary mode (bad), and
a lot of proprietary NMEA (bad).  But it should work fine in basic
NMEA mode.

> gpsd -V: gpsd: 3.16 (revision 3.16-4)
> OS: Rasbian as installed by NOOBS 3.0.1

Ouch!  3.16 is pretty old.  Some CVE in there you want to avoid..

Does NOOBS use systemd?

> Hardware works. Can switch "on" this board. After sending:
> echo "ATE0" > /dev/ttyAMD0
> echo "AT+CGNSPWR=1" > /dev/ttyAMA0

Ouch.  Also non-standard for a GPS...

> PPS LED turns blinking 1s pulses after about 28s. GPIO pin 18 is
> pulled every second.

So good PPS.  Can you see the PPS on /dev/pps0?

> # cat < /dev/ttyAMA0
> does not give back anything.

Did you set the serial port to 115,200 first?

> Starting gpsd with
> # gpsd -N /dev/ttyAMA0

Ah, you forgot the "-n'.  ALWAYS use -n for time service.

> starts gpsd running as user gpsd. But it does not lead to nothing.
> gpsd is just started nothing else happens. Seems to wait on data
> on /dev/ttyAMA0.

Yup, becAuse you forgot the -n.  With -n gpsd talks to the GPS
right away.  Without -n is awaits a client.

> Any idea how to initialize the SIM868 based board to make it work
> with gpsd?

Nope.  Never heard of one.  But we have lot's of guesses, and it
may take some work due to the "inventive" messages it uses.

> I found the sequence:
> echo 'ATE0' > /dev/ttyAM0
> echo 'AT+CGNSPWR=1' > /dev/ttyAM0
> echo 'AT+CGNSSEQ="RMC"' > /dev/ttyAM0
> echo 'AT+CGNSINF' > /dev/ttyAM0
> echo 'AT+CGNSURC=2' > /dev/ttyAM0
> echo 'AT+CGNSTST=1" > /dev/ttyAM0

Gack.  You will want that in a script.  I would suggest a "sleep 1"
between every one.  Most GPS have tiuny CPU and their input buffer
can be overrun,

> cat </dev/ttyAMA0
> To produce:

So you have the correct speed, but a sleeping GPS on start.

> $GNGGA,112828.000,4813.289882,N,01135.392671,E,1,16,0.73,522.354,M,47.554,M,,*70
> $GPGSA,A,3,14,02,31,06,25,29,12,32,24,,,,1.31,0.73,1.09*06
> $GLGSA,A,3,88,71,80,72,81,79,82,,,,,,1.31,0.73,1.09*17
> $GPGSV,3,1,10,25,76,319,29,12,56,075,50,29,52,214,26,02,40,082,44*78
> $GPGSV,3,2,10,14,31,283,37,32,28,262,16,31,27,310,35,24,22,152,20*78
> $GPGSV,3,3,10,06,21,043,44,44,14,118,*77
> $GLGSV,3,1,10,81,64,061,46,79,60,103,27,80,57,323,31,82,51,180,21*69
> $GLGSV,3,2,10,88,20,031,30,71,14,319,32,78,10,121,24,70,06,272,*63
> $GLGSV,3,3,10,72,05,005,36,83,05,197,*65
> $GNRMC,112828.000,A,4813.289882,N,01135.392671,E,0.00,0.00,080519,,,A*74
> $GNVTG,0.00,T,,M,0.00,N,0.00,K,A*23
> $GNGGA,112829.000,4813.289882,N,01135.392671,E,1,16,0.73,522.354,M,47.554,M,,*71
> $GPGSA,A,3,14,02,31,06,25,29,12,32,24,,,,1.31,0.73,1.09*06
> $GLGSA,A,3,88,71,80,72,81,79,82,,,,,,1.31,0.73,1.09*17
> $GPGSV,3,1,10,25,76,319,29,12,56,075,50,29,52,214,26,02,40,082,44*78
> $GPGSV,3,2,10,14,31,283,37,32,28,262,19,31,27,310,35,24,22,152,20*77
> $GPGSV,3,3,10,06,21,043,44,44,14,118,*77
> $GLGSV,3,1,10,81,64,061,46,79,60,103,28,80,57,323,31,82,51,180,20*67
> $GLGSV,3,2,10,88,20,031,30,71,14,319,32,78,10,121,22,70,06,272,*65
> $GLGSV,3,3,10,72,05,005,36,83,05,197,*65
> Then cgps works. But: how do I force gpsd to send this sequence to
> SIM868?

Well, you could patch the C code...  You can also use the "gpsctl -x"
command, that is a bit of a pain.  Likely you can use your echo script,
then start "gpsd -n" immediately.

> /etc/gpsd/device-hook exists and holds:

That file is NOT part of gpsd.  You need to talk to whoever is
maintaining" your several year old gpsd package.

> A little bit clueless now, because I need this to start automatically
> right after booting my RPi.

Most RasPi/HAT users want the same thing.  Eventually most rip our there
broken init code that came from their distro, not from gpsd, and
find a way to hook a cistom script on startup.  On Gentoo any script
you put in /etc/local.d/XXX.start is run on start.  I have no idea
what your disto does.

Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  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: pgpne0IHiI70q.pgp
Description: OpenPGP digital signature

reply via email to

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