Sparkfun SAM-M10Q (SparkFun_u-blox_GNSS_v3) - configure I2C ubx messages sent by GPS chip

Hello all,

I recently acquired a Sparkfun SAM-M10Q board and I’m utilizing the SparkFun_u-blox_GNSS_v3 library from GitHub. The SAM-M10Q is connected to an ESP32 devkit via I2C.

My current M10Q configuration is as follows:

GNSS.setI2COutput(COM_TYPE_UBX); // Set the I2C port to output UBX only (turn off NMEA noise)
GNSS.setNavigationFrequency(10); // Produce 10 solutions per second
GNSS.setAutoPVT(true);

I’m unsure about the specific effects of these three lines of code at the M10Q level. My objective is to minimize the data transmitted via I2C for two reasons:

  • Free up bandwidth for other I2C devices on the bus.

  • Minimize “blocking” time of the “SparkFun_u-blox_GNSS_v3” library during I2C read operations.

I am reading the GPS data through the following call:

if (GNSS.getPVT() == true)
{
  double latitude = GNSS.getLatitude() * 0.0000001;
  ...
}

Since I only need (lat, lon, alt) [as far as I understand that’s PVT] from the GPS, I want to disable all other UBX messages sent by the SAM-M10Q. Is there a way to achieve this?

Hi,

By default, the module outputs no UBX messages - only NMEA. You have disabled NMEA via setI2COutput, so PVT should be the only message being generated.

If you have run other examples from the library, you may have enabled additional messages. GNSS.factoryDefault will reset the module back to its original state (outputting NMEA only).

PVT is 100 bytes. Approx. 1000 bits on I2C (including start and stop). At 10Hz, the bit rate will be approx. 10000 bits/second. So you should be OK using 100kHz I2C.

I hope this helps,

Paul

Hi Paul, thank you for the answer! That helps a lot!

Just one last question: how do I enable additional UBX messages via SparkFun GNSS lib? I couldn’t find examples where additional UBX messages are enabled. I’m asking just to understand the functionality of the SparkFun GNSS library better.

Thank you!

If moving to 10Hz I would recommend disabling messages on the UART1 interface, both the interface, and the NMEA messages.

If you swamp the slowest interface you’ll get $GxTXT txbuf,alloc warnings.

@clive1: thanks for the reminder!

@nocsspecop: as Clive says, you also need to think about the UART port. That also has NMEA enabled by default and will be trying to output the standard NMEA messages at 10Hz. At 9600 baud - the default - it is easy to saturate the port and, like Clive says, that becomes the limiter. You may see the navigation rate fall back to what the port(s) can cope with.

GNSS.setUART1Output(COM_TYPE_UBX); will disable the NMEA messages - limiting the port to UBX only

GNSS.setUART1Output(0); will disable UART1 completely

You asked about other messages:

Some of the examples use the other “auto” (periodic) methods: setAutoNAVSAT will enable the UBX NAV SAT message; setAutoNAVPOSECEF will enable UBX NAV POSECEF etc… By default the message setting is stored in RAM and Battery-Backed RAM, so the messages remain enabled after a power cycle. factoryDefault will reset everything and clear the BBR.

For the NMEA messages, you can selectively enable / disable those using the configuration interface (VALSET):

// Disable or enable various NMEA sentences over the I2C interface

myGNSS.setI2COutput(COM_TYPE_NMEA | COM_TYPE_UBX); // Turn on both UBX and NMEA sentences on I2C.

myGNSS.newCfgValset(VAL_LAYER_RAM_BBR); // Use cfgValset to disable / enable individual NMEA messages

myGNSS.addCfgValset(UBLOX_CFG_MSGOUT_NMEA_ID_GLL_I2C, 0);

myGNSS.addCfgValset(UBLOX_CFG_MSGOUT_NMEA_ID_GSA_I2C, 0);

myGNSS.addCfgValset(UBLOX_CFG_MSGOUT_NMEA_ID_GSV_I2C, 0);

myGNSS.addCfgValset(UBLOX_CFG_MSGOUT_NMEA_ID_RMC_I2C, 1);

myGNSS.addCfgValset(UBLOX_CFG_MSGOUT_NMEA_ID_VTG_I2C, 1);

myGNSS.addCfgValset(UBLOX_CFG_MSGOUT_NMEA_ID_GGA_I2C, 1);

myGNSS.addCfgValset(UBLOX_CFG_MSGOUT_NMEA_ID_ZDA_I2C, 1);

if (myGNSS.sendCfgValset()) // Send the configuration VALSET

Serial.println(F(“NMEA messages were configured successfully”));

else

Serial.println(F(“NMEA message configuration failed!”));

I hope this helps,

Paul

@clive1, @PaulZC: thank you both! Very valuable informations and thank you for the code examples, they help understanding what to do!