gpsd-users
[Top][All Lists]
Advanced

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

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


From: A.S.
Subject: Re: [gpsd-users] gpsd interfacing to Raspberry PI
Date: Tue, 14 May 2019 10:56:49 -0400

Add the parameter "-n" (lower case 'n') to have it query the gps hardware immediately on start.

On Tue, May 14, 2019 at 10:52 AM Thomas Schweikle <address@hidden> wrote:
Hi!

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

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

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

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

# cat < /dev/ttyAMA0

does not give back anything.
Starting gpsd with

# gpsd -N /dev/ttyAMA0

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.

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

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
cat </dev/ttyAMA0

To produce:
$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?
/etc/gpsd/device-hook exists and holds:

--- snip
#!/bin/bash -x

tty=/dev/ttyAMA0
stty -F ${tty} 115200

function SerialWrite() {
        exec 4<${tty} 5>${tty}
        echo "$1" >&5; sleep 1
}

if [ "$1" = "${tty}" ]; then
        case "$2" in
        ACTIVATE*)
                SerialWrite "ATE0"
                SerialWrite "AT+CGNSPWR=1"
                SerialWrite "AT+CGNSSEQ=\"RMC\""
                SerialWrite "AT+CGNSINF"
                SerialWrite "AT+CGNSURC=2"
                SerialWrite "AT+CGNSTST=1"
                ;;

        DEACTIVATE*)
                SerialWrite "AT+CGNSPWR=0"
                ;;
        *)
                echo "$2 ???"
                ;;
        esac
fi
--- snap

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

--
Thomas

reply via email to

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