gpsd-users
[Top][All Lists]
Advanced

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

Re: powering on gps device


From: Nachiket Gokhale
Subject: Re: powering on gps device
Date: Wed, 23 Jun 2021 14:28:46 +0530

Yo Gary!

I think I was able to get gpsd to open the serial port /dev/ttyS0 and read from it. I think the problem was that there were other gpsds listening. However, gpsmon still cannot open /dev/ttyS0. And gpsd cannot open /dev/ttyS0 after "gpsmon /dev/ttyS0" is used. However, if gpsmon is not used before gpsd, gpsd seems to access /dev/ttyS0.  

>   So we need to know what model of receiver you have to help.  

I believe it is a SIMCom SIM808

>  Good.  Are you installing a package, from a tar ball, or from git?

I'm installing on a Raspberry Pi using apt. So it must be the Ubuntu/Debian package.

>  And you forgot to run as root?

No, I'm running everything as root. 

My problem now is that gpsd does not seem to read the NMEA (GPGGA) sentences sent by the GPS unit to /dev/ttyS0.  When gpsd is not running I can cat /dev/ttyS0 and see the GPGGA sentences. If I terminate gpsd using ctrl+C the sentences stop coming to /dev/ttyS0

The following is the output of my GPSD

gpsd -N -D3  /dev/ttyS0
gpsd:INFO: launching (Version 3.17)
gpsd:INFO: listening on port gpsd
gpsd:INFO: stashing device /dev/ttyS0 at slot 0
gpsd:INFO: running with effective group ID 20
gpsd:INFO: running with effective user ID 115
gpsd:INFO: startup at 2021-06-23T06:59:03.000Z (1624431543)
gpsd:CLIENT: => client(0): {"class":"VERSION","release":"3.17","rev":"3.17","proto_major":3,"proto_minor":12}\x0d\x0a
gpsd:CLIENT: <= client(0): ?WATCH={"enable":true,"json":true}\x0a
gpsd:INFO: SER: opening GPS data source type 2 at '/dev/ttyS0'
gpsd:INFO: SER: speed 115200, 8N1
gpsd:INFO: SER: speed 9600, 8O1
gpsd:INFO: SER: speed 115200, 8N1
gpsd:INFO: SER: speed 9600, 8N1
gpsd:INFO: SER: speed 115200, 8N1
gpsd:INFO: gpsd_activate(2): activated GPS (fd 7)
gpsd:CLIENT: => client(0): {"class":"DEVICES","devices":[{"class":"DEVICE","path":"/dev/ttyS0","activated":"2021-06-23T06:59:15.245Z","native":0,"bps":115200,"parity":"N","stopbits":1,"cycle":1.00}]}\x0d\x0a{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false}\x0d\x0a

I don't understand why it runs with an effective group ID of 20 and effective user ID of 115. Shouldn't these IDs be 0 for processes started by root? I am launching gpsd as root.  

Also, as you can see, clients seem to connect to it. However, the client only receives the following data. There is no GPGGA data forwarded to the client.

{'class': 'VERSION', 'release': '3.17', 'rev': '3.17', 'proto_major': 3, 'proto_minor': 12}
----------------------------------------
{'class': 'DEVICES', 'devices': [{'class': 'DEVICE', 'path': '/dev/ttyS0', 'activated': '2021-06-23T07:15:34.175Z', 'native': 0, 'bps': 115200, 'parity': 'N', 'stopbits': 1, 'cycle': 1.0}]}
----------------------------------------
{'class': 'WATCH', 'enable': True, 'json': True, 'nmea': False, 'raw': 0, 'scaled': False, 'timing': False, 'split24': False, 'pps': False}

CGPS shows only the following output

{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"
115200,"parity":"N","stopbits":1,"cycle":1.00}]}
{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"
timing":false,"split24":false,"pps":false}

Any help would be much appreciated. It almost seems that the receiver stops sending the GPGGA data once gpsd is connected to /dev/ttyS0.

Nachiket



On Tue, Jun 22, 2021 at 11:36 PM Gary E. Miller <gem@rellim.com> wrote:

Most GPS receivers need nothing to start sending data.  Those that
do not follow no attern. 

 

> Apologies if my question is simple or obvious. I'm very new to
> communicating with serial (or gps) devices. I'm trying to install
> gpsd on a Raspberry Pi. As per the instructions at
>
> https://gpsd.io/installation.html


> I should first check if I can get data from my GPS using
>
> stty -F /dev/ttyS0 ispeed 4800 && cat </dev/ttyS0

Few modern GPS acturally run at 4800.  And almost none ever ran
at slit seeds.

> This does not yield anything.

Which may just mean you set the wrong speed, or the input is
not confirged properly.

> So, I should fix this first. I think
> this is because the device is not powering up.

I would not expect that to power up a powered down device.  Few
GPS actually power down, looks like yours is one of the unlucky ones.

> However, I can send
> the right AT commands to power up the device attached to the serial
> port using the Python script given at the end of this message.

Notice your script sets the speed to 115,200?  Not close to 4,800.
The sends an AT command.

So  I fail to see you problem.  You know how to power up your device,
do that, then run gpsd.

> I open
> two terminals, run the Python script in one of them and type
>
> cat /dev/ttyS0
>
> in the other terminal. The cat then gives me GPGGA sentences.

Good.

> However,
>
> gpsmon /dev/ttyS0 gives
>
> gpsmon:ERROR: SER: /dev/ttyS0 already opened by another process

You fail to mentio if you ran that as root?  gpsmon usually needs
root.  And, of course, the cat must be stopped first.

> Which makes me think that what I did is not good enough for gpsd,

It is.

> because doing gpsd -N -D3  /dev/ttyS0 gives:
>
> gpsd:INFO: launching (Version 3.17)

3.17 is really old.

> gpsd:INFO: listening on port gpsd
> gpsd:INFO: stashing device /dev/ttyS0 at slot 0
> gpsd:INFO: running with effective group ID 20
> gpsd:INFO: running with effective user ID 115

And you forgot to run as root?

> gpsd:ERROR: SER: device open of /dev/ttyS0 failed: Device or resource
> busy

Yup, same error as before.  You forgot to run as root, or cat is
still running.

> So how can I wake up the device and make it available to gpsd?

You already know how to wake it up.  You prolly just forgot to run
gpsmon, and gpsd, as root.

> ser = serial.Serial(
>     port='/dev/ttyS0', #Replace ttyS0 with ttyAM0 for Pi1,Pi2,Pi0
>     baudrate = 115200,

Note: not 4,800!

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

reply via email to

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