Over a million developers have joined DZone.

Running gpsd on a Raspberry Pi 3 Over UART

DZone's Guide to

Running gpsd on a Raspberry Pi 3 Over UART

Kevin Hooke shares some steps he took for handling a bug while connecting GPS Shield on Pi 3, including a recommendation for fixing it.

· IoT Zone
Free Resource

Cisco IoT makes digital transformation a reality in factories, transportation, and utilities. Learn how to start integrating with Cisco DevNet.

Adafruit have a great tutorial for connecting and setting up their GPS Shield on the Pi. To connect it direct to the tx/tx GPIO pins on the Pi (instead of USB), there’s some additional steps covered here. Since the Pi 3 uses it’s hardware serial with the onboard Bluetooth, there’s additional steps covered that are Pi 3 specific.

After following those steps however, runnning cgps would run for a second and quit, with ‘No Fix’. What’s odd was that doing a ‘cat /dev/ttyS0′ would show the GPS NMEA messages being received, so I could tell the GPS board was up and receiving, but something else was not right.

Instead of starting gpsd as a daemon, running it form the commandline with additional debugging options gave some additional clues:

pi@raspberrypi:~ $ sudo gpsd /dev/ttyS0 -n -N -D3 -F /var/run/gpsd.sock

gpsd:INFO: launching (Version 3.11)

gpsd:ERROR: can’t bind to IPv4 port gpsd, Address already in use

gpsd:ERROR: maybe gpsd is already running!

gpsd:ERROR: can’t bind to IPv6 port gpsd, Address already in use

gpsd:ERROR: maybe gpsd is already running!

gpsd:INFO: command sockets creation failed, netlib errors -1, -1

This thread has others with the same issue. There are some suggestions towards the end of the thread to edit /lib/systemd/system/gpsd.socket and change some values, but the one recommendation that worked for me was to use this to start the service:

sudo service gpsd start

and then running cgps connected to the gpsd daemon, and everything is good!

Cisco is a software company. Surprised? Don’t be. Join DevNet to explore APIs, tools, and techniques that developers are using to add collaboration, IoT, security, network priority, and more!

iot ,raspberry pi 3 ,tutorial

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}