Installation

Prerequisites

Prior to installing the RasPiGNSS make sure you have:

  • a Raspberry Pi model A, B, A+, B+, Zero, Zero W, model 2, or model 3 or 4 (either one will fit), installed with:
  • the latest Raspbian image from the Raspberry Pi Foundation download page.
  • a suitable power supply for the Raspberry Pi delivering at least 0.3 amps more than the minimum specification released by the Raspberry Pi foundation for your specific Raspberry Pi model,
  • a RasPiGNSS module,
  • a GPS or better a combined GPS/GLONASS antenna (for best results we recommend quality antennas like the ones from Tallysman, especially the TW2410 or the less expensive TW4421. According to our tests these are known to deliver excellent reception in conjunction with the RasPiGNSS expansion board.).

Note: The Raspbian images from 2014-09-09-wheezy-raspbian.img onwards enable pulldowns on the GPIOs and therefore the RasPiGNSS RESET pin (P1 pin 12, GPIO 18) by default. This keeps the NV08C-CSM always in a RESET state, and the board seems “dead”. In order to make the RESET pin work as intended you first have to disable the pulldowns with rpio pulloff 12 prior to using the device. This restores normal behaviour of this pin as was the case with the previous 2014-06-20-wheezy-raspbian.img. All tools mentioned below have been updated to reflect this firmware change.

Installing the hardware

Previous RasPiGNSS module mounted on a Raspberry Pi model 1B
  • Make sure your RasPi is powered off. Never try to assemble the RasPiGNSS module when power is applied to the RasPi!
  • Carefully mount the RasPiGNSS expansion board on the RasPi’s P1 expansion port, precisely aligning all pins with the respective holes on the RasPiGNSS connector as shown in the picture to the right. Do not exert excessive force as you may bend or break pins, voiding your warranty on both the RasPi and the RasPiGNSS expansion board! Take utmost care to avoid misalignment of the pins, as applying power to a misaligned RasPiGNSS will definitely kill your RasPi and/or the RasPiGNSS expansion board!
RasPiGNSS “Aldebaran” mounted on a Raspberry Pi model 4

Note: On Raspberry Pi models which feature a 40-pin expansion port (A+, B+, 0, 2, 3, 4), the RasPiGNSS needs to be mounted on the first 26 pins, which are electrically compatible to the earlier models 1A and 1B. The first 26 pins on the new models are the ones starting right beside the power and activity LEDs. You can see how it needs to be mounted on a Raspberry Pi model with a 40-pin connector in the image to the right. Note that when mounted properly, the mounting holes of the Raspberry Pi and the RasPiGNSS module align perfectly.

Installing the software

  • Ensure that in /boot/config.txt the UART clock is set to 6 MHz. Insert the line init_uart_clock=6000000 in /boot/config.txt and reboot. Otherwise you cannot switch the RasPiGNSS to BINR mode which requires a baud rate of 230400 baud on the UART.
  • Make absolutely sure that your /dev/ttyAMA0 serial port is unused! (see Preventing Linux from using the serial port on the eLinux wiki)
    • ensure there are no references to /dev/ttyAMA0 in /boot/cmdline.txt.
    • ensure there are no references to /dev/ttyAMA0 in /etc/inittab
    • Reboot!
  • Download and install the rpgtools. (Note: Privileges are required to access /dev/ttyAMA0, so add the user under which you’re executing those scripts to the ‘dialout’ group or execute them with root privileges. These tools are provided under a GNU public license.
    • nvsmode switches serial port parameters and NV08C operating modes
    • nvsfw flashes new firmware onto the NV08C; Note: Package lrzsz required (sudo apt-get install lrzsz)
    • nvsctl for intialising and controlling the NV08C
    • nmeacmd issues a NMEA command to the NV08C, see NMEA protocol specification
    • binrcmd issues a BINR command to the NV08C, see BINR protocol specification
    • rpio generic tool to read and set the RasPi’s GPIO ports; Note: Device::BCM2835 module from CPAN required. For the Pi2 use at least version 1.39 of Mike McCauley’s bcm2835 library. For convenience you may download a compiled and packaged Debian package of this library here.
    • nmeaparse helps to get an overview of the satellites in view and used for a solution in NMEA mode. Remember to switch to NMEA mode with nvsmode nmea before using this command! You can find a more detailed description of this command in the FAQ.

Note: Most of the tools need access to the RasPi GPIO ports and therefore to the /dev/mem special device, which needs root privileges to be accessed. So either execute those tools as root, use sudo sometool or set the tools setuid bit using chmod ug+s sometool. Although newer releases of the Raspbian operating system support unprivileged GPIO access, this is not sufficient for the RasPiGNSS, as it uses the serial connection as well, therefore using root privileges with the rpgtools is mandatory.

Note for Debian “Jessie” and later: In /boot/cmdline.txt there is no reference to /dev/ttyAMA0, this is called console=serial0,115200 – remove that. Also, with the switch from upstart to the systemd init system, /etc/inittab has vanished. In order to disable a getty process on /dev/ttyAMA0 run the commands sudo systemctl stop serial-getty@ttyAMA0.service and sudo systemctl disable serial-getty@ttyAMA0.service.

Note: On the Pi3 and Pi4 there has been a hardware change: The previous PL011 UART /dev/ttyMA0 is now used by the Bluetooth chip. The pins used by the RasPiGNSS for serial communication with the NV08C-CSM are now mapped to /dev/ttyS0 mini-UART. This mini-UART, however, does not have its own clock generator, but uses the CPU clock. CPU clock scaling due to undervoltage or heat causes baud rate glitches and therefore transmission errors. Therefore I strongly discourage use of the /dev/ttyS0 port for use with the RasPiGNSS. Fortunately there’s a device tree overlay pi3-miniuart-bt that restores the old behaviour and remaps /dev/ttyAMA0 to the GPIO pins used by the RasPiGNSS, and makes the Bluetooth chip use /dev/ttyS0. For this to work, insert dtoverlay=pi3-miniuart-bt into your /boot/config.txt. Look up the details in the Raspberry Pi forums.

Note: On the Pi3 with the latest Raspbian Jessie release (from 2016-05-27) you need to manually re-enable the UART, because it will be switched off by default now. Put enable_uart=1 into /boot/config.txt to re-enable the UART, otherwise /dev/ttyAMA0 will be gone.

Note: On the Pi4 make sure to use the latest libbcm2835 library (at least version 1.60). Due to the new SOC used on the Pi4, previous versions of the library will not work.

Using the device

The NV08C can operate in various operating modes, the most important are NMEA mode (which is the default), and BINR mode (for raw data streaming). Furthermore, each of these modes supports a range of different baud rates on the serial port. To simplify mode switching, use the tool nvsmode, which switches the RasPi /dev/ttyAMA0 serial port and the NV08C from NMEA 115200 8N1 to/from BINR 230400 8O1. The following examples assume that you have all of the above utilities installed at a location included in your shell’s $PATH.

Note: The -v command line option turns on “verbose” mode for all tools below. You may omit that when using the tools in your own scripts. You may obtain detailed help and usage information for each command with the -h or --help command line options.

IMPORTANT! Before using the RasPiGNSS make sure you initialise the GPIOs on the expansion port with the following command:

# nvsctl -v init

Otherwise the RasPiGNSS seems to be “dead”, because due to the Raspberry Pi firmware settings the NV08C will be kept in a RESET state!

Obtaining an NMEA stream

First you have to switch the NV08C to NMEA mode, in case it isn’t:

# nvsmode -v nmea

Then you can view the NMEA message stream simply with:

# cat /dev/ttyAMA0

You can send NMEA commands to the NV08C, e.g. set navigation parameters to include SBAS corrections, 60 degrees elevation mask, 10Hz navigation rate, 30dBHz min SNR, and no position filter:

# nmeacmd -v PONAV 1 60 10 30 0

You can find the full NMEA documentation for the NV08C at the NVS website.

Obtaining a BINR stream

You may obtain the full BINR specification for the NV08C at the NVS website.

First you have to switch the NV08C to BINR mode, in case it isn’t:

# nvsmode -v binr

Then you have to enable the binary message types you like to show up in the BINR stream. The following sequence will set the navigation rate to 2 Hz, enable raw data output for use with RTKLIB, and enable SBAS corrections:

# binrcmd -v NAVRATE 2
# binrcmd -v DIFFCOR 2 1
# binrcmd -v RAWDATA 5

Note: When scripting initialization sequences for the NV08C it may be necessary to wait a certain amount between initialization commands for the NV08C to properly
process the command. You may achieve this using e.g. binrcmd WAIT 200 to wait 200 ms.

Using RTKLIB’s rtkrcv with RasPiGNSS

Besides the command line utilities the tar file provided above also contains an example initialisation script init.cmd and rtkrcv.conf configuration file.
Use binrcmd -v init.cmd to initialise the RasPiGNSS. init.cmd looks like this:

# reboot without erasing saved parameters
WARMSTART
WAIT 200

# set navgation rate in Hz (1,2,5,10 Hz)
NAVRATE 2
WAIT 200

# differential correction SBAS w/ RTCA troposphere model
DIFFCOR 2 1
WAIT 1000

# raw data output in intervals of dezi-secs (100ms)
# 1 -> 10Hz, 2 -> 5Hz, 5 -> 2Hz, 10 -> 1Hz (inverse
# setting but must be the same or greater than NAVRATE !!)
RAWDATA 5
WAIT 200

# bit information transmitted by satellites
BITINF 1
WAIT 200

# reboot without erasing saved parameters
WARMSTART
WAIT 200

Then you can dump the BINR message stream to a .nvs file for processing with RTKLIB simply with:

# cat /dev/ttyAMA0 >binrfile.nvs

Consult the NVS BINR specification for a detailed description of available message types.

Note: If you intend to use rtkrcv from RTKLIB v2.4.2 make sure you enabled NVS support (see issue #91 at RTKLIB support).
We provide a precompiled RTKLIB version 2.4.2p4 commandline binaries for your convenience for the Raspberry Pi including a sample configuration file for rtkrcv in PPP mode.

When initialised properly you may then run rtkrcv -s -p 2950 -o rtkrcv.conf to start the server reading commands from /dev/ttyAMA0, providing a monitor stream on port 2950 and an NMEA output stream on port 2947.

To help setting up an RTK system consisting of base station and rover, additional files are included in the rpgtools package:

  • rtkbase with config file /etc/rtkbase.conf – this sets up an RTK base station as an RTCM3 server, to which the rover connects to.
  • /etc/rtkrover.conf – a sample rover config file for rtkrcv using base station RTCM3 input.

You may configure this setup to directly deliver NVS BINR protocol to the rover. This setup needs more bandwidth than a pure RTCM3 one, but delivers more information to the rover (esp. bit information from satellites), that is not present in the RTCM3 protocol. In this case you have to modify both /etc/rtkbase.conf and /etc/rtkrover.conf to use NVS BINR (“nvs”) as the communications protocol.

You have to have a communication channel between base station and rover for those messages. This can be anything from a WiFi link, a Bluetooth connection, or a dedicated RF communications module (e.g. the ISM-band XBee modules).

Flashing the firmware

You can flash new firmware onto the NV08C with:

# nvsfw -v nv08_p2_CSM_WRITE_NNNN.bin

Firmware updates may be obtained from the NVS website.

Resetting the device

You can reset the NV08C with the following command:

# nvsctl -v reset

This pulls the RESET line of the NV08C low, waits for 100ms, and sets it high again.

Using the LEDs and Push-Buttons

The LEDs and push-buttons are connected to regular GPIO pins on the RasPi P1 expansion port, and may be controlled with any suitable GPIO support library like the libbcm2835 or the WiringPi library. The rpio utility is included for that purpose that simplifies GPIO handling significantly; however you have to install the Device::BCM2835 Perl module from CPAN first. To switch all LEDs on simultaneously use:

# rpio -v hi out 15 16 18

This switches pins 15, 16, and 18 to output mode and sets them to a high level thus turning on the LEDs. To switch them off again use:

# rpio -v lo 15 16 18

The pins still remain configered as outputs after this command. To configure pins as input, enable pullups, and read their pin status use:

# rpio -v in pullup read 7 11 22

This configures pins 7, 11, and 22 as inputs, enables pull-up resistors on them, and reads their pin status, thus querying if any of the tactile switches or the reed contact have been actuated.

⯇ Specifications ⯅ RasPiGNSS "Aldebaran" Micro-SD Adapter ⯈