[Top][All Lists]

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

[gpsd-users] gpsd interfacing to Raspberry PI

From: Thomas Schweikle
Subject: [gpsd-users] gpsd interfacing to Raspberry PI
Date: Wed, 8 May 2019 13:42:14 +0200


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

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

stty -F ${tty} 115200

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

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

                SerialWrite "AT+CGNSPWR=0"
                echo "$2 ???"
--- snap

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


reply via email to

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