How to access GPS NMEA sentences through USB on the BerryGPS-GSM

By default, the GPS module on the BerryGPS-GSM outputs to the Raspberry Pi RX and TX pins. However, if you need to use these pins for something else or you want to connect the BerryGPS-IMU via USB only, you can redirect the NMEA sentences  to one of its USB serial interfaces.

The two main components on the BerryGPS-GSM are;

The block diagram below shows how these are connected, you can see that a serial switch is used to select which module (GSP, GSM or none) is connected to the Raspberry Pi RX/TX pins.

By default, the GPS is connected to the Pi RX/TX pins, this only works if the BerryGPS-GSM is sitting onto of the Raspberry Pi.

If you are connecting the BerryGPS-GSM by USB only, you will need to access the GPS NMEA sentence through the USB interface.

This can easily be done as the SARA-U201 and CAM-M8 speak to each other via i2c.

First, connect to the second COM port of the GSM module;

pi@raspberrypi ~ $ minicom -b 115200 -o -D /dev/ttyACM1

Activate storing of last values of NMEA, from the GPS to the GSM module by entering these AT commands;

AT+UGRMC=1
AT+UGGLL=1
AT+UGGSV=1
AT+UGGGA=1

Activate the unsolicited aiding result. Without this, you will not know if the GPS has started correctly.

AT+UGIND=1

Set NMEA data to stream through USB interface /dev/ttyACM3;

AT+UGPRF=1

Turn on GPS, (Start GNSS with GPS+SBAS+GLONASS systems and local aiding.);

AT+UGPS=1,1,67

The +UGPS command is used to control the GPS module and the assist mode. Here is its syntax and options;
AT+UGPS=[mode],[aid_mode],[GNSS_systems]
[mode]
0 : Off
1 : On
[aid_mode]
0 (default value): no aiding
1: automatic local aiding
2: AssistNow Offline
4: AssistNow Online
8: AssistNow Autonomous
[GNSS_systems]
1: GPS
2: SBAS
4: Galileo
8: BeiDou
16: IMES
32: QZSS
64: GLONAS

To view the stream;

pi@raspberrypi ~ $ minicom -b 115200 -o -D /dev/ttyACM3

to stop GPS;

AT+UGPS=0
This document describes these all these commands in detail.

Blip, blop, bloop…