[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-users] gpsd interfacing to Raspberry PI
From: |
Lisandro Damián Nicanor Pérez Meyer |
Subject: |
Re: [gpsd-users] gpsd interfacing to Raspberry PI |
Date: |
Tue, 14 May 2019 13:26:00 -0300 |
El miércoles, 8 de mayo de 2019 08:42:14 -03 Thomas Schweikle escribió:
> 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:
[snip]
> Then cgps works. But: how do I force gpsd to send this sequence to SIM868?
I will first try to avoid gpsd having anything to do. Simply configure the
SIM868 and then save it's configuration.
Tip: use minicom to send the config.
> /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
Interesting, didn't know about this. I would spy on the serial port to see if
the commands are correct. You could also try sending 3 or 4 "AT" commands
alone at the beggining, in case autobauding is set up.
--
Some consider UNIX to be the second most important invention to come out
of AT&T Bell Labs after the transistor.
Dennis Ritchie, creator of the C programming language and co-creator of UNIX
http://www.linfo.org/q_unix.html
Lisandro Damián Nicanor Pérez Meyer
http://perezmeyer.com.ar/
http://perezmeyer.blogspot.com/
signature.asc
Description: This is a digitally signed message part.