Warning
This document assumes you are using gpsd version 3.20 or higher. Not all u-blox 9 examples work in version 3.20. Using older gpsd versions will fail in strange ways.

Introduction

The u-blox GNSS receivers have a huge number of configuration options. Most users will be perfectly happy running their receiver in its default configuration, but there are often times when users get the itch to change settings to see what happens. Sometimes even for good reasons.

Important
Feel free to jump around this document to recipes that interest you, but be sure to first read all of, and comply with, the section on Initial Setup.

Many of the recipes repeat text from other recipes so that recipes can stand alone. Except all recipes require the Initial Setup section.

Initial Setup

All the examples here assume that gpsd is running on the local host and that cgps is showing current and valid data from the receiver.

If cgps is not showing any data, then do not bother to continue reading this document.

You also need a copy of the "Interface Description" for your exact u-blox device. The examples here will refer to a lot of messages and variables that are defined in that document. Keep it open while reading this document and refer to it often.

Protocol Version

All the examples below require that you know the protocol version of your u-blox receiver.

$ ubxtool -p MON-VER

Buried in the data will be a data block that similar one of these examples.

A u-blox 6, assume protocol version 12

UBX-MON-VER:
  swVersion 6.02 (36023)
  hwVersion 00040007

A u-blox 8, protocol version 15

UBX-MON-VER:
  swVersion 2.01 (75331)
  hwVersion 00080000
  extension PROTVER 15.00
  extension GPS;SBAS;GLO;BDS;QZSS

The shortcut to find the PROTVER for u-blox 8 and up:

$ ubxtool -p MON-VER | fgrep PROT
extension PROTVER=18.00

The above shows the protocol version is 18.00.

The ubxtool program needs to know the protocol version (PROTVER) of the connected receiver to send commands matched to your exact receiver’s needs. Use the "-P XX" option for this, where XX is your version. This is easy to forget, and annoying to type repeatedly, so add it to your environment and ubxtool will use it. For example if you have an early u-blox 8:

$ export UBXOPTS="-P 15"

You can add "-v 2" for a little more verbosity.

$ export UBXOPTS="-P 18 -v 2"

Defaut Configuration

A common problem when dealing with a u-blox GNSS receiver is left over configuration from earlier experiments. The u-blox receivers are very picky about competing configuration options, and may fail to warn the unwary of conflicts. Best to always revert to factory defaults before starting a new configuration.

$ ubxtool -p RESET

After a few seconds the receiver will only be sending NMEA, you will want to enable u-blox binary messages, and disable NMEA messages. Best to do it in that order so the receiver does not go totally silent. This is one place where the "-P", set in UBXOPTS, is critically important, to get the correct messages for your firmware.

$ ubxtool -e BINARY
$ ubxtool -d NMEA

Dynamic Platform Model

The most common variable mis-configured in a u-blox receiver is the Dynamic Platform Model. The receiver uses noisy measurements of satellite signals and attempts to interpret those as single PVT fix. By default the receiver assumes the receiver is "Portable" and not experiencing large accelerations. Place that receiver in a car or airplane, and the smoothing will act perversely on the fix. Take a moment now to read the section on Platform Settings in your u-blox documentation. Different receivers support different models, so no generic recommendations are possible.

Check your current Dynamic Platform Model:

$ ubxtool -p CFG-NAV5
UBX-CFG-NAV5:
 mask 0xffff dynModel 0 fixmode 3 fixedAlt 0 FixedAltVar 10000
 minElev 5 drLimit 0 pDop 250 tDop 250 pAcc 100 tAcc 350
 staticHoldThresh 0 dgpsTimeOut 60 cnoThreshNumSVs 0
 cnoThresh 0 res 0 staticHoldMaxDist 0 utcStandard 0
 reserved x0 0
   dynModel (Portable) fixMode (Auto 2D/3D) utcStandard (Default)
   mask (dyn minEl posFixMode drLim posMask timeMask staticHoldMask
         dgpsMask cnoThreshold utc)

That shows the receiver is in the default Portable model.

To change the active model to Automotive (4), and check it again, is simply:

$ ubxtool -p MODEL,4
[...]
$ ubxtool -p CFG-NAV5
UBX-CFG-NAV5:
 mask 0xffff dynModel 4 fixmode 3 fixedAlt 0 FixedAltVar 10000
 minElev 5 drLimit 0 pDop 250 tDop 250 pAcc 100 tAcc 350
 staticHoldThresh 0 dgpsTimeOut 60 cnoThreshNumSVs 0
 cnoThresh 0 res 0 staticHoldMaxDist 0 utcStandard 0
 reserved x0 0
   dynModel (Automotive) fixMode (Auto 2D/3D) utcStandard (Default)
   mask (dyn minEl posFixMode drLim posMask timeMask staticHoldMask
         dgpsMask cnoThreshold utc)

Changing Dynamic Platform Model with Configuration Items

If the receiver is a 9-series one then you can change the model using Configuration Items. These allow you to get, set and delete individual settings in the receiver. before continuing this section, read the ubxtool man page on Configuration Items.

The CFG-NAVSPG Configuration Item group includes the CFG-NAV5 items of interest here. So take a look at them, in the ram layer:

# ubxtool -g CFG-NAVSPG,0
[...]
UBX-CFG-VALGET:
 version 1 layer 0 position 0
  layers (ram)
    item CFG-NAVSPG-18/0x10110012 val 0
    item CFG-NAVSPG-INIFIX3D/0x10110013 val 0
    item CFG-NAVSPG-20/0x10110014 val 1
    item CFG-NAVSPG-21/0x10110015 val 1
    item CFG-NAVSPG-22/0x10110016 val 1
    item CFG-NAVSPG-24/0x10110018 val 1
    item CFG-NAVSPG-USE_PPP/0x10110019 val 0
    item CFG-NAVSPG-27/0x1011001b val 0
    item CFG-NAVSPG-ACKAIDING/0x10110025 val 0
    item CFG-NAVSPG-70/0x10110046 val 1
    item CFG-NAVSPG-82/0x10110052 val 0
    item CFG-NAVSPG-83/0x10110053 val 0
    item CFG-NAVSPG-USE_USRDAT/0x10110061 val 0
    item CFG-NAVSPG-129/0x10110081 val 0
    item CFG-NAVSPG-130/0x10110082 val 0
    item CFG-NAVSPG-131/0x10110083 val 0
    item CFG-NAVSPG-FIXMODE/0x20110011 val 3
    item CFG-NAVSPG-26/0x2011001a val 18
    item CFG-NAVSPG-UTCSTANDARD/0x2011001c val 0
    item CFG-NAVSPG-32/0x20110020 val 100
    item CFG-NAVSPG-DYNMODEL/0x20110021 val 1
    item CFG-NAVSPG-34/0x20110022 val 0
    item CFG-NAVSPG-35/0x20110023 val 0
    item CFG-NAVSPG-36/0x20110024 val 1
    item CFG-NAVSPG-38/0x20110026 val 0
    item CFG-NAVSPG-66/0x20110042 val 2
    item CFG-NAVSPG-67/0x20110043 val 3
    item CFG-NAVSPG-68/0x20110044 val 1
    item CFG-NAVSPG-69/0x20110045 val 1
    item CFG-NAVSPG-81/0x20110051 val 0
    item CFG-NAVSPG-INFIL_MINSVS/0x201100a1 val 3
    item CFG-NAVSPG-INFIL_MAXSVS/0x201100a2 val 32
    item CFG-NAVSPG-INFIL_MINCNO/0x201100a3 val 6
    item CFG-NAVSPG-INFIL_MINELEV/0x201100a4 val 5
    item CFG-NAVSPG-INFIL_NCNOTHRS/0x201100aa val 0
    item CFG-NAVSPG-INFIL_CNOTHRS/0x201100ab val 0
    item CFG-NAVSPG-CONSTR_DGNSSTO/0x201100c4 val 60
    item CFG-NAVSPG-213/0x201100d5 val 0
    item CFG-NAVSPG-SIGATTCOMP/0x201100d6 val 0
    item CFG-NAVSPG-WKNROLLOVER/0x30110017 val 2029
    item CFG-NAVSPG-OUTFIL_PDOP/0x301100b1 val 250
    item CFG-NAVSPG-OUTFIL_TDOP/0x301100b2 val 250
    item CFG-NAVSPG-OUTFIL_PACC/0x301100b3 val 100
    item CFG-NAVSPG-OUTFIL_TACC/0x301100b4 val 350
    item CFG-NAVSPG-OUTFIL_FACC/0x301100b5 val 150
    item CFG-NAVSPG-USRDAT_DX/0x40110064 val 0.0
    item CFG-NAVSPG-USRDAT_DY/0x40110065 val 0.0
    item CFG-NAVSPG-USRDAT_DZ/0x40110066 val 0.0
    item CFG-NAVSPG-USRDAT_ROTX/0x40110067 val 0.0
    item CFG-NAVSPG-USRDAT_ROTY/0x40110068 val 0.0
    item CFG-NAVSPG-USRDAT_ROTZ/0x40110069 val 0.0
    item CFG-NAVSPG-USRDAT_SCALE/0x4011006a val 0.0
    item CFG-NAVSPG-CONSTR_ALT/0x401100c1 val 0
    item CFG-NAVSPG-CONSTR_ALTVAR/0x401100c2 val 10000
    item CFG-NAVSPG-209/0x401100d1 val 0
    item CFG-NAVSPG-210/0x401100d2 val 0
    item CFG-NAVSPG-211/0x401100d3 val 0
    item CFG-NAVSPG-USRDAT_MAJA/0x50110062 val 6378137.0
    item CFG-NAVSPG-USRDAT_FLAT/0x50110063 val 298.257223563

We can now use CFG-NAVSPG-DYNMODEL to change the model back to Pedestrian, and then confirm the setting:

$ ubxtool -z CFG-NAVSPG-DYNMODEL,0
[...]
$ ubxtool -z CFG-NAVSPG-DYNMODEL,0
[...]
UBX-CFG-VALGET:
 version 1 layer 0 position 0
  layers (ram)
    item CFG-NAVSPG-DYNMODEL/0x20110021 val 0

Rate Settings

There can be a good need to change the rate at which your receiver take measurements, or how many measurements it uses to compute its navigation solution (fix). Slow down the measurement rate to save power. Or speed it up in fast moving dynamic environments. Using several measurements sets for each fix computation may remove some noise. No one size fits all.

Note
Not all u-blox can take measurements faster than 1 Hz.

The current configuration can be seen this way:

$ ubxtool -p CFG-RATE
[...]
UBX-CFG-RATE:
 measRate 1000 navRate 1 timeRef 1 (GPS)

To change to a 10 Hz measurement and fix rate, then check your work:

$ ubxtool -p RATE,100
[...]
$ ubxtool -p CFG-RATE
[...]
UBX-CFG-RATE:
 measRate 000 navRate 1 timeRef 1 (GPS)

Rate Settings with Configuration Items

If the receiver is a 9-series one then you can change the rate at which the receiver takes measurements and/or computes the navigation solution (fix) using Configuration Items. These allow you to get, set and delete individual settings in the receiver. before continuing this section, read the ubxtool man page on Configuration Items.

The CFG-NAVSPG Configuration Item group includes the CFG-NAV5 items of interest here. So take a look at them, in the ram layer:

# ubxtool -g CFG-RATE,0
[...]
UBX-CFG-VALGET:
 version 1 layer 0 position 0
  layers (ram)
    item CFG-RATE-TIMEREF/0x20210003 val 1
    item CFG-RATE-MEAS/0x30210001 val 1000
    item CFG-RATE-NAV/0x30210002 val 1

You can change the measurement rate to 0.1 Hz, and check it, this way:

$ ubxtool -z CFG-RATE-MEAS,10000,1
sent:
UBX-CFG-VALSET:
 version 0 layer 0x1 transaction 0x0 reserved 0
  layers (ram) transaction (Transactionless)
    item CFG-RATE-MEAS/0x30210001 val 10000

UBX-ACK-ACK:
  ACK to Class x06 (CFG) ID x8a (VALSET)
[...]
$ ubxtool -g CFG-RATE-MEAS,1
[...]
UBX-CFG-VALGET:
 version 1 layer 0 position 0
  layers (ram)
    item CFG-RATE-MEAS/0x30210001 val 10000

Constellations

For unknown reasons, one of the first things newbies want to play with is the constellation settings. If you are headed to the polar regions, into space, or to Asia, then these settings will be of interest to you. Otherwise, unless you have a Rubidium atomic clock handy, or run 12-hour experiments with gpsprof, it will be hard for you to improve on the defaults. If you still must fiddle, then read on, after completing the above section on Initial Setup.

Changing Constellations

First you must understand what your GNSS receiver is capable of. Find this out with the UBX-MON-GNSS message.

$ ubxtool -p MON-GNSS

If your receiver does not return an ACK-ACK message, then it is 7-series or earlier, and only receives from GPS satellites. Owners of 7-series, or older receivers can stop reading this section now.

A u-blox 8 may return something like this:

UBX-MON-GNSS:
   version 0 supported 0x7 defaultGnss 0x3 enabled 0x3
   simultaneous 2 reserved1 0 0 0
     supported (GPS Glonass Beidou)
     defaultGnss (GPS Glonass)
     enabled (GPS Glonass)

That 8 can support GPS, GLONASS, and BeiDou, but only two at a time.

A u-blox 9 might return something like this:

UBX-MON-GNSS:
   version 0 supported 0xf defaultGnss 0xf enabled 0xd
   simultaneous 4 reserved1 0 0 0
     supported (GPS Glonass Beidou Galileo)
     defaultGnss (GPS Glonass Beidou Galileo)
     enabled (GPS Beidou Galileo)

That 9 can support GPS, GLONASS, BeiDou, and Galileo, and all at the same time. But in that case, GLONASS is turned off.

There are more details to see with UBX-CFG-GNSS. A u-blox 8 might show:

$ ubxtool -p CFG-GNSS -v 2
[...]
UBX-CFG-GNSS:
 msgVer 0  numTrkChHw 32 numTrkChUse 32 numConfigBlocks 5
  gnssId 0 TrkCh  8 maxTrCh 16 reserved 0 Flags x01010001
   GPS L1C/A enabled
  gnssId 1 TrkCh  1 maxTrCh  3 reserved 0 Flags x01010001
   SBAS L1C/A enabled
  gnssId 3 TrkCh  8 maxTrCh 16 reserved 0 Flags x01010000
   BeiDou B1I
  gnssId 5 TrkCh  0 maxTrCh  3 reserved 0 Flags x01010001
   QZSS L1C/A enabled
  gnssId 6 TrkCh  8 maxTrCh 14 reserved 0 Flags x01010001
   GLONASS L1 enabled

That shows 5 constellations, not 2. Since GPS, SBAS and QZSS all use the same frequency and modulation, they were lumped together by MON-GNSS as simply GPS.

An L2 capable 9-series may look like this:

UBX-CFG-GNSS:
 msgVer 0  numTrkChHw 60 numTrkChUse 60 numConfigBlocks 5
  gnssId 0 TrkCh  8 maxTrCh 16 reserved 0 Flags x11110001
   GPS L1C/A L2C enabled
  gnssId 2 TrkCh 10 maxTrCh 18 reserved 0 Flags x21210001
   Galileo E1 E5b enabled
  gnssId 3 TrkCh  4 maxTrCh  5 reserved 0 Flags x11010001
   BeiDou B1I enabled
  gnssId 5 TrkCh  0 maxTrCh  3 reserved 0 Flags x11110001
   QZSS L1C/A L2C enabled
  gnssId 6 TrkCh  8 maxTrCh 12 reserved 0 Flags x11110001
   GLONASS L1 L2 enabled

There are several things to note. SBAS is not shown. Outside of FAA requirements, SBAS no longer has any value to the user, and is simply not supported. Multiple signals per constellation are shown, and can be individually enabled.

Changing Constellations

The 9-series receives a large number of signals in parallel, so other than for testing, there is no need to change the defaults that listen to everything.

Stepping back a bit, the 8-series is more problematic. Many of them can only listen to two out of the three possible frequency bands: GPS, GLONASS and BeiDou. Most default to GPS and GLONASS, but GPS and Beidou may work better. This is partly because most GPS-only antenna can receiver BeiDou, but fail to receive GLONASS. Partly because BeiDou and GLONASS sats cover different regions of the earth.

If we first try to enable BeiDou, that will fail, as that would enable 3 constellations when only 2 are supported. So disable GLONASS, then enable BeiDou, then check. Always check as u-blox does not reliably report errors.

$ ubxtool -d GLONASS
[...]
$ ubxtool -e BEIDOU
[...]
$ ubxtool -p CFG-GNSS
[...]
UBX-CFG-GNSS:
 msgVer 0  numTrkChHw 32 numTrkChUse 32 numConfigBlocks 5
  gnssId 0 TrkCh  8 maxTrCh 16 reserved 0 Flags x01010001
   GPS L1C/A enabled
  gnssId 1 TrkCh  1 maxTrCh  3 reserved 0 Flags x01010001
   SBAS L1C/A enabled
  gnssId 3 TrkCh  2 maxTrCh 16 reserved 0 Flags x01010001
   BeiDou B1I enabled
  gnssId 5 TrkCh  0 maxTrCh  3 reserved 0 Flags x01010001
   QZSS L1C/A enabled
  gnssId 6 TrkCh  8 maxTrCh 14 reserved 0 Flags x01010000
   GLONASS L1

After a few minutes, if you are in a location which BeiDou covers, then you should start to see BeiDou sats in the cgps sat list. The 8-series has many other constraints on setting CFG-GNSS, the masochistic will need to spend a lot of quality time with the u-blox documentation to lean the many ways to shoot yourself in the foot.

While the need for changing what the 9-series listens for is less, the complexity of doing so is increased. Not only must the constellation be selected, but also the signals within the constellation.

Let us disable GLONASS on a ZED-F9P, then enable it, and check the results:

$ ubxtool -d GLONASS
[...]
$ ubxtool -e GLONASS
[...]
$ ubxtool -p CFG-GNSS
[...]
UBX-CFG-GNSS:
 msgVer 0  numTrkChHw 60 numTrkChUse 60 numConfigBlocks 5
  gnssId 0 TrkCh  8 maxTrCh 16 reserved 0 Flags x11110001
   GPS L1C/A L2C enabled
  gnssId 2 TrkCh 10 maxTrCh 18 reserved 0 Flags x21210001
   Galileo E1 E5b enabled
  gnssId 3 TrkCh  4 maxTrCh  5 reserved 0 Flags x11010001
   BeiDou B1I enabled
  gnssId 5 TrkCh  0 maxTrCh  3 reserved 0 Flags x11110001
   QZSS L1C/A L2C enabled
  gnssId 6 TrkCh  8 maxTrCh 12 reserved 0 Flags x11110000
   GLONASS L1 L2

Note that GLONASS is still disabled. Determining why is left as an exercise to the reader. The receiver must be told to enable both frequencies before it complies:

$ ubxtool -e GLONASS,2
[...]
$ ubxtool -p CFG-GNSS
[...]
UBX-CFG-GNSS:
 msgVer 0  numTrkChHw 60 numTrkChUse 60 numConfigBlocks 5
  gnssId 0 TrkCh  8 maxTrCh 16 reserved 0 Flags x11110001
   GPS L1C/A L2C enabled
  gnssId 2 TrkCh 10 maxTrCh 18 reserved 0 Flags x21210001
   Galileo E1 E5b enabled
  gnssId 3 TrkCh  4 maxTrCh  5 reserved 0 Flags x11010001
   BeiDou B1I enabled
  gnssId 5 TrkCh  0 maxTrCh  3 reserved 0 Flags x11110001
   QZSS L1C/A L2C enabled
  gnssId 6 TrkCh  8 maxTrCh 12 reserved 0 Flags x11110001
   GLONASS L1 L2 enabled

Another reason to always check your work when using ubxtool.

Changing Constellations with Configuration Items

The astute will have noticed that the canned ubxtool commands, like "-e GLONASS", send one or binary messages that may change a handful or variables at once. The 9-series avoids this mess with Configuration Items. These allow you to get, set and delete individual settings in the receiver. before continuing this section, read the ubxtool man page on Configuration Items.

The CFG-SIGNAL Configuration Item group includes the CFG-GNSS items of interest here. So take a look at them, in the ram layer:

$ ubxtool -g CFG-SIGNAL,0
[...]
UBX-CFG-VALGET:
 version 1 layer 0 position 0
  layers (ram)
    item CFG-SIGNAL-GPS_L1CA_ENA/0x10310001 val 1
    item CFG-SIGNAL-GPS_L2C_ENA/0x10310003 val 1
    item CFG-SIGNAL-GAL_E1_ENA/0x10310007 val 1
    item CFG-SIGNAL-GAL_E5B_ENA/0x1031000a val 1
    item CFG-SIGNAL-BDS_B1_ENA/0x1031000d val 1
    item CFG-SIGNAL-BDS_B2_ENA/0x1031000e val 0
    item CFG-SIGNAL-QZSS_L1CA_ENA/0x10310012 val 1
    item CFG-SIGNAL-QZSS_L2C_ENA/0x10310015 val 1
    item CFG-SIGNAL-GLO_L1_ENA/0x10310018 val 1
    item CFG-SIGNAL-GLO_L2_ENA/0x1031001a val 1
    item CFG-SIGNAL-GPS_ENA/0x1031001f val 1
    item CFG-SIGNAL-GAL_ENA/0x10310021 val 1
    item CFG-SIGNAL-BDS_ENA/0x10310022 val 1
    item CFG-SIGNAL-QZSS_ENA/0x10310024 val 1
    item CFG-SIGNAL-GLO_ENA/0x10310025 val 1
    item CFG-SIGNAL-39/0x10310027 val 1
[...]

Notice that the BeiDou B2 signal is not enabled. That might be because when the firmware was written there were not B2 signals from space to test. Or maybe not, who knows, but we want to enable it to see if anything changes. So we will use the "-z" command to enable it, and the "-g" command to check it in layer 0.

$ ubxtool -z CFG-SIGNAL-BDS_B2_ENA,1
[...]
$ ubxtool -g CFG-SIGNAL-BDS_B2_ENA,0
[...]
UBX-CFG-VALGET:
 version 1 layer 0 position 0
  layers (ram)
    item CFG-SIGNAL-BDS_B2_ENA/0x1031000e val 1

Logging

Sometimes you want your GNSS receiver to be able to log PVT fixes for later retrieval. This allows the host to go into sleep mode to save power. Logs are stored in external flash memory. Some GNSS receivers, like the NEO-M8B, allow the receiver to go into sleep mode between fixes to save even more power.

Be sure you have performed all the steps in Initial Setup before proceeding to the following logging specific steps.

Logging Prerequisites

For Logging, you need:

  1. u-blox 7, 8 or 9 GNSS receiver (protocol version 15+)

  2. external flash memory

If you do not meet the above prerequisites, then you can stop reading this section now.

The easy way to see if your firmware supports logging is to ask it:

$ ubxtool -p LOG-INFO

There are three possible results.

One, the receiver does not return ACK-ACK, ACK-NAK, or any UBX-LOG-INFO message. That means your receiver does not support logging. Game over, your receiver does not support logging.

Two, the receiver returns something similar to this:

    UBX-LOG-INFO:
      version 1 reserved1 x0 x0 filestoreCapacity 0 reserved2 x0 x0
      currentMaxLogSize 0 currentLogSize 0 entryCount 0
      oldestYear 0 oldestMonth 0 oldestDay 0
      oldestHour 0 oldestMin 0 oldestSec 0 reserved3 x0
      newestYear 0 newestMonth 0 newestDay 0
      newestHour 0 newestMin 0 newestSec 0 reserved4 x0
      status x10 reserved5 x0 x0

The filestoreCapacity of zero means you have no flash for logging to use. Game over, your receiver does not support logging.

Three, the receiver returns something similar to this:

    UBX-LOG-INFO:
      version 1 reserved1 x0 x0 filestoreCapacity 487680 reserved2 x9600 x24900
      currentMaxLogSize 134400 currentLogSize 61 entryCount 0
      oldestYear 0 oldestMonth 0 oldestDay 0
      oldestHour 0 oldestMin 0 oldestSec 0 reserved3 x0
      newestYear 0 newestMonth 0 newestDay 0
      newestHour 0 newestMin 0 newestSec 0 reserved4 x0
      status x20 reserved5 x0 x0

That means your receiver has almost 500 kB of flash, and about 134 kB is available for logging. Congratulations, your receiver supports logging. Proceed to the next section on configuration.

Logging Configuration

Be sure you have completed the instructions in the section Initial Setup before continuing here.

Erase any exiting log:

$ ubxtool -p LOG-ERASE
[...]
sent:
UBX-LOG-ERASE:
  Erase Logged Data
UBX-ACK-ACK:
  ACK to Class x21 (LOG) ID x03 (ERASE)

Create new log:

$ ubxtool -p LOG-CREATE
[...]
sent:
UBX-LOG-CREATE:
  version 0 logCfg x1 reserved1 x0 logSize 0
  userDefinedSize 0

UBX-ACK-ACK:
  ACK to Class x21 (LOG) ID x07 (CREATE)

Start logging:

$ ubxtool -e LOG
[...]
sent:
UBX-CFG-LOGFILTER:
 version 1 flags x5 minInterval 0 timeThreshold 0
 speedThreshold 0 positionThreshold 0

UBX-ACK-ACK:
  ACK to Class x06 (CFG) ID x47 (LOGFILTER)

Wait, then verify that the receiver is logging data:

$ ubxtool -p LOG-INFO -v 2
UBX-LOG-INFO:
  version 1 reserved1 x0 x0 filestoreCapacity 487680 reserved2 x9600 x24900
  currentMaxLogSize 134400 currentLogSize 88 entryCount 8
  oldestYear 2020 oldestMonth 5 oldestDay 22
  oldestHour 22 oldestMin 33 oldestSec 56 reserved3 x0
  newestYear 2020 newestMonth 5 newestDay 22
  newestHour 22 newestMin 26 newestSec 41 reserved4 x0
  status x28 reserved5 x0 x0
      status (recording circular)

Add a string:

$ ubxtool -p LOG-STRING -v 2
[...]
UBX-ACK-ACK:
  ACK to Class x21 (LOG) ID x04 (STRING)

Wait for a few more fixes to be logged, then turn off logging.

$ ubxtool -d LOG -v 2
[...]
sent:
UBX-CFG-LOGFILTER:
 version 1 flags x0 minInterval 0 timeThreshold 0
 speedThreshold 0 positionThreshold 0
   flags ()

UBX-ACK-ACK:
  ACK to Class x06 (CFG) ID x47 (LOGFILTER)

Verify that logging is indeed off:

$ ubxtool -p LOG-INFO -v 2
[...]
UBX-LOG-INFO:
  version 1 reserved1 x0 x0 filestoreCapacity 487680 reserved2 x9600 x24900
  currentMaxLogSize 134400 currentLogSize 288 entryCount 33
  oldestYear 2020 oldestMonth 5 oldestDay 22
  oldestHour 22 oldestMin 33 oldestSec 56 reserved3 x0
  newestYear 2020 newestMonth 5 newestDay 22
  newestHour 22 newestMin 34 newestSec 11 reserved4 x0
  status x20 reserved5 x0 x0
      status (circular)

Retrieve log data:

$ ubxtool -p LOG-RETRIEVE -v 2
[...]
UBX-LOG-RETRIEVEPOS:
  entryIndex 12 lon -1213142510 lat 440688770 hMSL 1128900 hAcc 7000
  gSpeed 90 heading 28500000 version 0 fixType 3
  year 2020 month 5 day 22 hour 22 min 34 sec 2
  reserved1 x0 numSV 7 reserved2 x0
      fixType (3D Fix)

UBX-LOG-RETRIEVEPOSEXTRA:
  entryIndex 13 version 0 reserved1 x0
  year 2020 month 5 day 22 hour 22 minute 34 seconds 2
  reserved2 x0 0 distance 1252489 reserved3 x0 0 0

UBX-LOG-RETRIEVESTRING:
  entryIndex 14 version 0 reserved2 x0
  year 2020 month 5 day 22 hour 22 min 34 sec 2
  reserved2 x0 byteCount 2
  bytes "Hi"

UBX-LOG-RETRIEVEPOS:
  entryIndex 15 lon -1213142470 lat 440688690 hMSL 1128600 hAcc 7000
  gSpeed 240 heading 26300000 version 0 fixType 3
  year 2020 month 5 day 22 hour 22 min 34 sec 3
  reserved1 x0 numSV 8 reserved2 x0
      fixType (3D Fix)
[...]

Erase and clear existing log, before you can enable log again:

$ ubxtool -p LOG-ERASE
$ ubxtool -p LOG-CREATE

Batching

U-blox batching is like logging, but logging is saved in flash memory, and batching is saved in RAM memory. Not all u-blox receivers have RAM available for batching.

Be sure you have performed all the steps in Initial Setup before proceeding to these batching specific steps.

Batching Prerequisites

For batching, you need:

  1. u-blox 8 or 9 GNSS receiver (protocol version 23.01+)

  2. RAM memory

If you do not meet the above prerequisites, then you can stop reading now.

The easy way to see if your firmware supports batching is to ask it:

$ ubxtool -p MON-BATCH

If the receiver does not ACK, or NAK, that request, then it does not support batching. Game over, do not bother to continue with this example.

If your receiver does support batching, you will see something similar to this:

$ ubxtool -p MON-BATCH
ubxtool: poll MON-BATCH

sent:
UBX-MON-BATCH:
  Poll request

UBX-MON-BATCH:
   version 0 reserved1 0 0 0 fillLevel 128
   dropsAll 65535 dropsSinceMon 4 nextMsgCnt 166

Check your u-blox documentation for what UBX-MON-BATCH just told you.

Batching Configuration

Be sure you have completed the instructions in the section Initial Setup before continuing here.

Enable batching:

$ ubxtool -e BATCH

Wait, then verify:

$ ubxtool -p CFG-BATCH -p MON-BATCH -v 2
[...]
UBX-CFG-BATCH:
  version 0 flags xd bufsize 128 notifThrs 0
  pioId 0 reserved1 0
      flags (enable extraPvt extraOdo)

UBX-ACK-ACK:
  ACK to Class x06 (CFG) ID x93 (BATCH)

UBX-MON-BATCH:
   version 0 reserved1 0 0 0 fillLevel 128
   dropsAll 321 dropsSinceMon 15 nextMsgCnt 38
[...]

Wait a while, for some fixes to be saved in the BATCH. Then check UBX-MON-BATCH and get all the batch entries:

$ ubxtool -p LOG-RETRIEVEBATCH -v 2
[...]
UBX-MON-BATCH:
   version 0 reserved1 0 0 0 fillLevel 128
   dropsAll 65535 dropsSinceMon 1310 nextMsgCnt 166

UBX-LOG-BATCH:
  version 0 contentValid x3 msgCnt 166 iTow 510334000
  year 2020 month 5 day 22 hour 21 min 45 sec 16 valid x37
  tAcc 30 fracSec 104291 fixType 3 flags x11 flags2 xa numSV 5
  lon -1213142428 lat 440690573 height 1130139 hMSL 1151489
  hAcc 9541 vAcc 11092
  vel N 288 E 111 D -29 gSpeed 274 headMot 2104222 sAcc 786 headAcc 4232547
  pdep 432 reserved1 x0 distance 1249842 totalDistance 1249842
  distanceStd 4880 reserved2 x0
      contentValid (extraPvt extraOdo) valid (validDate validTime)
      fixType (3D Fix)
      flags (gnssFixOK) psmState (Power Optimized Tracking)

There will be a number of UBX-LOG-BATCH with each of the individual batches fixes.

End batching:

$ ubxtool -d BATCH