gpsd-users
[Top][All Lists]
Advanced

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

Re: COEX GPS (model UBX-M8030 IC) on Raspberry Pi 4 Model B 2018 connect


From: Aranza Shaccid Leon
Subject: Re: COEX GPS (model UBX-M8030 IC) on Raspberry Pi 4 Model B 2018 connection issues
Date: Thu, 22 Jul 2021 18:58:58 -0700

Hello and good evening!

1) Okay, I'm a bit confused on how to get gpsd running without system d. I may be missing a command, such as    systemctl restart gpsd     after disabling it from system d perhaps? I'm just not sure how to get gpsd running after disabling gpsd and gpsd.socket?

>   PID TTY      STAT   TIME COMMAND
>   427 ?        S<s    0:00 /usr/sbin/gpsd /dev/ttyGPS

2) This is missing -n, I'm assuming because it's running on system d. I did type in:
root@clover-1060:~# gpsd -n /dev/ttyACM1
root@clover-1060:~# cgps
cgps: caught signal 2

 But this didn't show up in gpsdebuginfo and I just wanted to ask why it's listening to ttyACM0 since errors showed up for this. ttyACM0 is supposed to be the flight controller, not the GPS USB connection. Perhaps it's the way I have set up my udev rules?
Udev Rules:
KERNEL=="ttyACM[0-9]*", SUBSYSTEM=="tty", ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a8", SYMLINK="ttyGPS"  

3) Looking at just 

root@clover-1060:~# gpsd -n /dev/ttyACM1
root@clover-1060:~# cgps
cgps: caught signal 2

lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqklqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x    Time:       2021-07-22T23:49:47.000Z   xxPRN:   Elev:  Azim:  SNR:  Used: x
x    Latitude:                                                 xx   8    12    306    21      Y   x
x    Longitude:                                              xx  10    60    317    31      Y   x
x    Altitude:                                                    xx  15    19    060    23      Y   x
x    Speed:      0.09 kph                                xx  18    43    168    34      Y   x
x    Heading:    0.0 deg (true)                       xx  23    71    060    30      Y   x
x    Climb:      0.00 m/min                             xx  24    49    079    36      Y   x
x    Status:     3D DIFF FIX (12 secs)          xx  27    18    275    16      Y   x
x    Longitude Err:   +/- 2 m                          xx  32    39    245    26      Y   x
x    Latitude Err:    +/- 3 m                            xx 133    26    234    39      Y   x
x    Altitude Err:    +/- 8 m                              xx                                 x
x    Course Err:      n/a                                   xx                                 x
x    Speed Err:       n/a                                  xx                                 x
x    Time offset:     -72326.756                        xx                                 x
x    Grid Square:                                           xx                                 x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqjmqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

{"class":"TPV","device":"/dev/ttyGPS","status":2,"mode":3,"time":"2021-07-22T23:49:47.000Z"}

This works correctly, but then again I don't have system d in this example disabled so it's working how I had it set up before. I'm assuming this is why the device is labeled /dev/ttyGPS instead of -n /dev/ttyACM1 

4) These are the commands that I've given it now.

systemctl stop gpsd 
sudo systemctl disable gpsd
systemctl stop gpsd.socket
systemctl disable gpsd.socket

sudo su -
gpsd -n /dev/ttyACM1
cgps      (there is nothing appearing in cgps now)
cd /var/tmp
./gpsdebuginfo   (this of course will not have gpsd running so I'm missing something)
+ id -u
+ [ 0 != 0 ]
+ id
uid=0(root) gid=0(root) groups=0(root)
+ uname -a
Linux clover-1060 5.10.17-v7l+ #1414 SMP Fri Apr 30 13:20:47 BST 2021 armv7l GNU/Linux
+ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
+ command -v gpsd
/usr/sbin/gpsd
+ gpsd -V
gpsd: 3.17 (revision 3.17)
+ gpsd -h
+ grep ^#.*enabled
# Socket export enabled.
# Shared memory export enabled.
# DBUS export enabled
# Time service features enabled.
# PPS enabled.
+ command -v sockstat
+ command -v lsof
/usr/bin/lsof
+ lsof -iTCP:2947 -s TCP:LISTEN
COMMAND PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
gpsd    956 gpsd    3u  IPv4  20139      0t0  TCP localhost:gpsd (LISTEN)
gpsd    956 gpsd    4u  IPv6  20140      0t0  TCP localhost:gpsd (LISTEN)
+ lsof -c gpsd
+ sed -nE 1p;/CHR|LISTEN/p
COMMAND   PID USER   FD   TYPE     DEVICE SIZE/OFF  NODE NAME
gpsd      956 gpsd    0u   CHR        1,3      0t0     5 /dev/null
gpsd      956 gpsd    1u   CHR        1,3      0t0     5 /dev/null
gpsd      956 gpsd    2u   CHR        1,3      0t0     5 /dev/null
gpsd      956 gpsd    3u  IPv4      20139      0t0   TCP localhost:gpsd (LISTEN)
gpsd      956 gpsd    4u  IPv6      20140      0t0   TCP localhost:gpsd (LISTEN)
gpsd      956 gpsd    6u   CHR      166,1      0t0   412 /dev/ttyACM1
gpsdebugi 982 root    0u   CHR      136,0      0t0     3 /dev/pts/0
gpsdebugi 982 root    1u   CHR      136,0      0t0     3 /dev/pts/0
gpsdebugi 982 root    2u   CHR      136,0      0t0     3 /dev/pts/0
+ ps+  axsed
 -nE 1p;/gpsd/p
  PID TTY      STAT   TIME COMMAND
  956 ?        S<s    0:02 gpsd -n /dev/ttyACM1
  982 pts/0    S+     0:00 /bin/sh ./gpsdebuginfo
  996 pts/0    S+     0:00 sed -nE 1p;/gpsd/p
+ command -v gpspipe
/usr/bin/gpspipe
+ gpspipe -V
gpspipe: 3.17 (revision 3.17)
+ gpspipe -w -n 2 -x 20
gpspipe: invalid option -- 'x'
Usage: gpspipe [OPTIONS] [server[:port[:device]]]

-d Run as a daemon.
-o [file] Write output to file.
-h Show this help.
-r Dump raw NMEA.
-R Dump super-raw mode (GPS binary).
-w Dump gpsd native data.
-S Set scaled flag.
-2 Set the split24 flag.
-l Sleep for ten seconds before connecting to gpsd.
-t Time stamp the data.
-T [format] set the timestamp format (strftime(3)-like; implies '-t')
-u usec time stamp, implies -t. Use -uu to output sec.usec
-s [serial dev] emulate a 4800bps NMEA GPS on serial port (use with '-r').
-n [count] exit after count packets.
-v Print a little spinner.
-p Include profiling info in the JSON.
-P Include PPS JSON in NMEA or raw mode.
-V Print version and exit.

You must specify one, or more, of -r, -R, or -w
You must use -o if you use -d.
+ command -v ipcs
/usr/bin/ipcs
+ ipcs -m
+ sed -nE /key/p;/KEY/p;/0x4e5450/p
key        shmid      owner      perms      bytes      nattch     status
0x4e545030 0          root       600        80         1
0x4e545031 1          root       600        80         1
0x4e545032 2          root       666        80         1
0x4e545033 3          root       666        80         1
0x4e545034 4          root       666        80         1
0x4e545035 5          root       666        80         1
0x4e545036 6          root       666        80         1
0x4e545037 7          root       666        80         1
+ command -v ntpshmmon
/usr/bin/ntpshmmon
+ ntpshmmon -V
ntpshmmon: version 3.17 (revision 3.17)
+ ntpshmmon -n 6 -t 10
ntpshmmon version 1
#      Name Seen@                Clock                Real                 L Prec
+ ls -l /dev/pps* /dev/ttyACM0 /dev/ttyACM1 /dev/ttyAMA0
ls: cannot access '/dev/pps*': No such file or directory
crw-rw---- 1 root dialout 166,  0 Jul 22 03:17  /dev/ttyACM0
crw-rw---- 1 root dialout 166,  1 Jul 22 04:45  /dev/ttyACM1
crw-rw---- 1 root dialout 204, 64 Jul 22 03:17  /dev/ttyAMA0
+ command -v lsusb
/usr/bin/lsusb
+ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 26ac:0012
Bus 001 Device 003: ID 1546:01a8 U-Blox AG [u-blox 8]
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
+ echo PYTHONPATH
PYTHONPATH
+ command -v gpscat
/usr/bin/gpscat
+ command -v gpscat
+ head -n 1 /usr/bin/gpscat
#! /usr/bin/python
+ command -v python
/usr/bin/python
+ python -V
Python 2.7.16
+ python -c import gps;print(gps.__version__)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute '__version__'
+ command -v python3
/usr/bin/python3
+ python3 -V
Python 3.7.3
+ python3 -c import gps;print(gps.__version__)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'gps'
+ command -v systemctl
/usr/bin/systemctl
+ cat /etc/default/gpsd /etc/init.d/gpsd
# Default settings for the gpsd init script and the hotplug wrapper.

# Start the gpsd daemon automatically at boot time
START_DAEMON="true"

# Use USB hotplugging to add new USB devices automatically to the daemon
USBAUTO="true"

# Devices gpsd should collect to at boot time.
# They need to be read/writeable, either by user gpsd or the group dialout.
DEVICES="/dev/ttyGPS"

# Other options you want to pass to gpsd
GPSD_OPTIONS=""
#!/bin/sh
### BEGIN INIT INFO
# Provides:          gpsd
# Required-Start:    $remote_fs $syslog $network
# Should-Start:      bluetooth dbus udev
# Required-Stop:     $remote_fs $syslog $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# X-Start-Before:    ntp
# Short-Description: GPS (Global Positioning System) daemon
# Description:       The gpsd service daemon is able to monitor one or
#                    more GPS devices connected to a host computer, making
#                    all data on the location and movements of the sensors
#                    available to be queried on TCP port 2947.
### END INIT INFO

# Author: Bernd Zeimetz <bzed@debian.org>
#
# Please remove the "Author" lines above and replace them
# with your own name if you copy and modify this script.

# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script
RUNDIR=/run/gpsd
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="GPS (Global Positioning System) daemon"
NAME=gpsd
DAEMON=/usr/sbin/$NAME
PIDFILE=$RUNDIR/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

if [ -z "$GPSD_SOCKET" ] && [ -z "$DEVICES" ]; then
        GPSD_SOCKET=/var/run/gpsd.sock
fi

if [ -n "$GPSD_SOCKET" ]; then
        GPSD_OPTIONS="$GPSD_OPTIONS -F $GPSD_SOCKET"
fi

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start()
{
        # Return
        #   0 if daemon has been started
        #   1 if daemon was already running
        #   2 if daemon could not be started

        mkdir -p $RUNDIR || return 2

        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
                || return 1
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
                $GPSD_OPTIONS -P $PIDFILE $DEVICES \
                || return 2
}

#
# Function that stops the daemon/service
#
do_stop()
{
        # Return
        #   0 if daemon has been stopped
        #   1 if daemon was already stopped
        #   2 if daemon could not be stopped
        #   other if a failure occurred
        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
        RETVAL="$?"
        [ "$RETVAL" = 2 ] && return 2
        # Many daemons don't delete their pidfiles when they exit.
        rm -f $PIDFILE
        return "$RETVAL"
}

#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
        #
        # If the daemon can reload its configuration without
        # restarting (for example, when it is sent a SIGHUP),
        # then implement that here.
        #
        start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
        return 0
}

case "$1" in
  start)
        if [ "$START_DAEMON" = "true" ]; then
                [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
                do_start
                case "$?" in
                        0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                        2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
                esac
        else
                [ "$VERBOSE" != no ] && \
                        log_daemon_msg "Not starting $DESC" "$NAME" && \
                        log_end_msg 0
        fi
        ;;
  stop)
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
        do_stop
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  status)
       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
       ;;
  reload|force-reload)
        log_daemon_msg "Reloading $DESC" "$NAME"
        do_reload
        log_end_msg $?
        ;;
  restart)
        #
        # If the "reload" option is implemented then remove the
        # 'force-reload' alias
        #
        log_daemon_msg "Restarting $DESC" "$NAME"
        do_stop
        case "$?" in
          0|1)
                do_start
                case "$?" in
                        0) log_end_msg 0 ;;
                        1) log_end_msg 1 ;; # Old process is still running
                        *) log_end_msg 1 ;; # Failed to start
                esac
                ;;
          *)
                # Failed to stop
                log_end_msg 1
                ;;
        esac
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
        exit 3
        ;;
esac

:
+ systemctl cat gpsd.service
# /lib/systemd/system/gpsd.service
[Unit]
Description=GPS (Global Positioning System) Daemon
Requires=gpsd.socket
# Needed with chrony SOCK refclock
After=chronyd.service

[Service]
Type=forking
EnvironmentFile=-/etc/default/gpsd
ExecStart=/usr/sbin/gpsd $GPSD_OPTIONS $DEVICES

[Install]
WantedBy=multi-user.target
Also=gpsd.socket
+ systemctl cat gpsd.socket
# /lib/systemd/system/gpsd.socket
[Unit]
Description=GPS (Global Positioning System) Daemon Sockets

[Socket]
ListenStream=/var/run/gpsd.sock
ListenStream=[::1]:2947
ListenStream=127.0.0.1:2947
SocketMode=0600

[Install]
WantedBy=sockets.target
+ systemctl status gpsd.service
● gpsd.service - GPS (Global Positioning System) Daemon
   Loaded: loaded (/lib/systemd/system/gpsd.service; disabled; vendor preset: enabled)
   Active: inactive (dead) since Thu 2021-07-22 04:41:15 BST; 4min 38s ago
 Main PID: 812 (code=exited, status=0/SUCCESS)

Jul 22 04:39:42 clover-1060 systemd[1]: Starting GPS (Global Positioning System) Daemon...
Jul 22 04:39:42 clover-1060 systemd[1]: Started GPS (Global Positioning System) Daemon.
Jul 22 04:41:15 clover-1060 systemd[1]: Stopping GPS (Global Positioning System) Daemon...
Jul 22 04:41:15 clover-1060 systemd[1]: gpsd.service: Succeeded.
Jul 22 04:41:15 clover-1060 systemd[1]: Stopped GPS (Global Positioning System) Daemon.
+ systemctl status gpsd.socket
● gpsd.socket - GPS (Global Positioning System) Daemon Sockets
   Loaded: loaded (/lib/systemd/system/gpsd.socket; disabled; vendor preset: enabled)
   Active: inactive (dead) since Thu 2021-07-22 04:42:14 BST; 3min 39s ago
   Listen: /var/run/gpsd.sock (Stream)
           [::1]:2947 (Stream)
           127.0.0.1:2947 (Stream)

Jul 22 04:38:10 clover-1060 systemd[1]: Listening on GPS (Global Positioning System) Daemon Sockets.
Jul 22 04:42:14 clover-1060 systemd[1]: gpsd.socket: Succeeded.
Jul 22 04:42:14 clover-1060 systemd[1]: Closed GPS (Global Positioning System) Daemon Sockets.
+ journalctl -u gpsd.service --since today
-- Logs begin at Thu 2019-02-14 10:11:59 GMT, end at Thu 2021-07-22 04:45:12 BST. --
Jul 22 04:38:11 clover-1060 systemd[1]: Starting GPS (Global Positioning System) Daemon...
Jul 22 04:38:13 clover-1060 systemd[1]: Started GPS (Global Positioning System) Daemon.
Jul 22 04:39:42 clover-1060 systemd[1]: Stopping GPS (Global Positioning System) Daemon...
Jul 22 04:39:42 clover-1060 systemd[1]: gpsd.service: Succeeded.
Jul 22 04:39:42 clover-1060 systemd[1]: Stopped GPS (Global Positioning System) Daemon.
Jul 22 04:39:42 clover-1060 systemd[1]: Starting GPS (Global Positioning System) Daemon...
Jul 22 04:39:42 clover-1060 systemd[1]: Started GPS (Global Positioning System) Daemon.
Jul 22 04:41:15 clover-1060 systemd[1]: Stopping GPS (Global Positioning System) Daemon...
Jul 22 04:41:15 clover-1060 systemd[1]: gpsd.service: Succeeded.
Jul 22 04:41:15 clover-1060 systemd[1]: Stopped GPS (Global Positioning System) Daemon.
+ command -v aa-status
+ command -v apparmor_status
+ set +x
Please send the entire, untouched output.


These are all the steps I've taken, so if I'm missing something or there is a different order of commands I should follow, could you please advice me where I went wrong?

Thank you for your time and consideration. 

Sincerely,
Leon

On Thu, Jul 22, 2021 at 4:04 PM Gary E. Miller <gem@rellim.com> wrote:
Yo Aranza!

On Thu, 22 Jul 2021 17:44:22 -0700
Aranza Shaccid Leon <leon18@pnw.edu> wrote:

> Just as a quick clarification of my current situation:
> 1) I have the GPS connected to the flight controller with a UART
> connection and the flight controller is connected to my RPi via a
> USB. This is how I'm supposed to have it connected.

That was as I understood.

> 2) I disconnected the GPS from the flight controller, connected it to
> the RPi with a USB and inserted one line of udev rules in order for
> this connection to work.

Except, as we have seen, it does not.

> If I have the GPS connected to both the
> flight controller (UART connection) and the RPi (USB connection) the
> program will not run.

If by "program" you mean gpsd, then facts not in evidence.  If "program"
means something else, then that is new info.

How about we jsut get gpsd working first?

> Using gpsd -n /dev/ttyACM1 and then cgps in root did start the
> program and it did gather data.

Unclear what you mean by "program" and by "gather data".

Did cgps give you a good fix and time?

More important, what do you feel is now NOT working, as shown by this
most recent configuration.

> /usr/bin/lsof
> + lsof -iTCP:2947 -s TCP:LISTEN
> COMMAND PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
> systemd   1 root   58u  IPv6  11908     0t0  TCP localhost:gpsd (LISTEN)
> systemd   1 root   59u  IPv4  14690     0t0  TCP localhost:gpsd (LISTEN)
> gpsd    427 gpsd    4u  IPv6  11908     0t0  TCP localhost:gpsd (LISTEN)
> gpsd    427 gpsd    5u  IPv4  14690     0t0  TCP localhost:gpsd (LISTEN)

One agian, you have systemd(imwit) running on the gpsd port.  You
have NOT turned systemd(ipsy) off from controlling gpsd.

> + lsof -c gpsd
> + sed -nE 1p;/CHR|LISTEN/p
> COMMAND   PID USER   FD   TYPE     DEVICE SIZE/OFF  NODE NAME
> gpsd      427 gpsd    0u   CHR        1,3      0t0     5 /dev/null
> gpsd      427 gpsd    1u   CHR        1,3      0t0     5 /dev/null
> gpsd      427 gpsd    2u   CHR        1,3      0t0     5 /dev/null
> gpsd      427 gpsd    4u  IPv6      11908      0t0   TCP
> localhost:gpsd (LISTEN)
> gpsd      427 gpsd    5u  IPv4      14690      0t0   TCP
> localhost:gpsd (LISTEN)
> gpsd      427 gpsd    8u   CHR      166,0      0t0   378 /dev/ttyACM0

gpsd is listening on /dev/ttyACM0, but I thought your GPS was on /dev/ttyACM1??

> + ps ax
> + sed -nE 1p;/gpsd/p
>   PID TTY      STAT   TIME COMMAND
>   427 ?        S<s    0:00 /usr/sbin/gpsd /dev/ttyGPS

gpsd is missing the "-n" option.  That is NOT how I told you to start gpsd.

Confirm the /dev/ttyGPS is to /dev/ttyACM1 and that /dev/ttyACM1 is
the GPS?  Or is it /dev/ttyACM0?

> + gpspipe -w -n 2 -x 20
> gpspipe: invalid option -- 'x'

Here is where a recent version of gpspipe would ahve told me a lot.

>    Active: active (running) since Thu 2021-07-22 04:38:10 BST; 5min
> ago Listen: /var/run/gpsd.sock (Stream)
>            [::1]:2947 (Stream)
>            127.0.0.1:2947 (Stream)
>     Tasks: 0 (limit: 3737)
>    CGroup: /system.slice/gpsd.socket

That confirms you still have systemd(rama) controlling port 2947.

I can't help you if you continue to allow gpsd to run under systemd(racula).

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
CAUTION: This email originated from outside of the PNW environment. Do not click links or open attachments unless you recognize the sender and know the content is safe.


reply via email to

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