Sharing GPS data with other processes

We’ve got a Navio2 board connected to an RPi3B+ and everything works with regard to ArduPilot, but we want to run some additional software on the RPi. This software needs GPS data (for position) and an accurate time source (NTPD). We added a jumper from pin 3 of the U-blox chip to pin 12 of the RPi header (GPIO 18) to get the PPS signal, but the real hold up seems to be that ArduPilot is going directly to SPI to get the GPS feed from the U-blox chip.

Is there any supported way to configure ArduPilot to read the GPS data from a PTY (such as with the ublox-spi-to-pty utility)?

emlidtool version: 1.0.8
Vendor: Emlid Limited
Product: Navio 2
Issue: Emlid 2020-09-22 716f472abba15f9ec2b6fc51f498538e3c041d42
Kernel: 5.10.11-emlid-v7+
RCIO firmware: 0xb9064332

Hi Craig,

Welcome to the community forum!

That’s right. You can get the data by accessing the Navio2 chip via SPI. You can check the Python/C++ examples that show a way to decode UBX protocol messages. These scripts will provide you with the messages with current location data.

Please note that it doesn’t seem feasible to get the PPS output from the Navio2 chip.

Perhaps I wasn’t clear – I need to have GPSD AND the ArduPilot software running simultaneously, each getting GPS data, and I would like suggestions on the best way to do that.

IMO having GPSD parse the GPS feed and then having ArduPilot pulling GPS data from GPSD would be the best solution, but apparently ArduPilot isn’t set up for that, so I’m looking for a plan B.

Hi Craig,

It might be quite tricky to do so. ArduPilot and GPSD might be using the same resources, which might lead to conflicts and distorted values. That’s why we don’t recommend running any of the Navio2 examples while ArduPilot is enabled. It’s better to use GPSD separately.

The solution is to write a program that does the following:

  • Creates two PTS devices and appropriate symlinks (/dev/gps0 /dev/gps1)
  • Reads all of the data from the SPI device (/dev/spidev0.0) and break out Ublox and NMEA messages.
  • Writes all of the messages to each of the PTS devices.
  • Reads data from one of the PTS devices (/dev/gps1)
  • Writes that data back to the SPI device.

Then configure GPSD to use /dev/gps0 and ArduPilot to use /dev/gps1 (using the -B parameter).

My solution was written in Python, but you could write something similar in C or Go.

As for getting the PPS data for GPSD, do the following:

  • Solder a jumper from pin 3 of the U-blox chip to pin 12 of the RPi header (GPIO 18).
  • Add pps-gpio to the /etc/modules file.
  • Add /dev/pps0 to the GPSD devices list in /etc/default/gpsd
  • Configure NTPD per normal with GPSD and PPS.

Perhaps the next version of the Navio2 board will include that connection?