Category Archives: raspberry pi

How gpsd can interfere with your GNSS receiver and how to fix it

Pi and u-blox

Raspberry Pi 3 Model B and u-blox C94-M8P

In order to work with the u-blox C94-M8P on the Raspberry Pi, I installed a GPS interface called gpsd on the Pi. Documentation on gpsd can be found here. And this is the tutorial I used to install it on the Pi. However, there is one issue with gpsd that neither tutorial mentioned.

It turns out, when gpsd attempts to reconfigure certain Bluetooth- or USB-connected GPS receivers, it can interfere in strange ways with their functioning. I found that certain gpsd commands interfered with the C94-M8P’s ability to reach RTK mode. The receiver would initially reach RTK mode, then quickly lose it and achieve only a 2D/3D fix while gpsd was running.

After much digging, I found a solution. You can configure gpsd to run with the -b option, which is a read-only mode that prevents it from writing to the GPS receiver. This can be achieved when you install it, by passing -b to the Options to gpsd prompt, or, if you have already installed gpsd, you simply need to change the default parameters, as detailed below:

  • Start up your Pi and open the default file for gpsd with:

sudo nano /etc/default/gpsd

  • Set the parameters to look like this:

gpsd default settings

  • That’s it. Exit and reboot.

From the gpsd man page:

-b

Broken-device-safety mode, otherwise known as read-only mode. A few bluetooth and USB receivers lock up or become totally inaccessible when probed or reconfigured; see the hardware compatibility list on the GPSD project website for details. This switch prevents gpsd from writing to a receiver. This means that gpsd cannot configure the receiver for optimal performance, but it also means that gpsd cannot break the receiver. A better solution would be for Bluetooth to not be so fragile. A platform independent method to identify serial-over-Bluetooth devices would also be nice.

The read-only mode was a simple solution to a problem that plagued our group for over a week. If you are finding your Pi-connected USB or Bluetooth GPS mysteriously goes in and out of RTK mode and you have exhausted other causes, such as poor satellite reception at the base receiver or incorrect RTCM messages at the roving receiver, try checking your gpsd default parameters and adding this option.

u-blox tutorials

For my research project, I’ve worked pretty extensively with a certain Global Navigation Satellite System (GNSS) application board: the u-blox C94-M8P, which includes two u-blox NEO-M8P-2 receivers. It’s a highly accurate GNSS module with tons of cool functionalities (like anti-jamming capabilities) but takes quite the learning curve to be able to understand its various uses and settings.

So I’m starting this website by writing up a series of tutorials explaining some of the things I’ve learned about the C94-M8P and GNSS, such as:

  • how GPS works
  • all about NMEA sentences
  • what are RTCM messages
  • how RTK GPS works
  • using u-center, u-blox’s evaluation software
  • saving configuration settings with u-center
  • configuring the C94-M8P for base/rover mode
  • enabling RTCM messages on the C94-M8P
  • achieving RTK mode on the C94-M8P
  • troubleshooting why the receiver won’t achieve RTK fixed mode
  • using gpsd to interface with the C94-M8P on the Raspberry Pi
  • how gpsd can interfere with a GNSS receiver and how to fix it
  • converting latitude, longitude, and altitude to a north, east, down coordinate system
  • finding distance between base and rover

I’ve gathered this knowledge through a combination of research, reading u-blox manuals, browsing their Q&A forum (and especially learning from clive1), and my own trial and error. My hope is to contribute to the free library of online knowledge that I have benefited from and help others with similar technical problems to those I encountered.