Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 8063fd1

Browse files
author
Paul Clark
committed
Updated setVal and added 'multi' setVal with an Example (supersedes PR #28)
1 parent 37477bf commit 8063fd1

File tree

4 files changed

+438
-27
lines changed

4 files changed

+438
-27
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
Send UBX binary commands to enable RTCM sentences on Ublox ZED-F9P module
3+
Based on Example7 By: Nathan Seidle
4+
SparkFun Electronics
5+
Updated by Paul Clark to demonstrate setVal8/16/32, newCfgValset8/16/32, addCfgValset8/16/32 and sendCfgValset8/16/32
6+
Date: July 1st, 2019
7+
License: MIT. See license file for more information but you can
8+
basically do whatever you want with this code.
9+
10+
Ublox changed how to configure their modules in 2019. As of version 23 of the UBX protocol the
11+
UBX-CFG commands are deprecated; they still work, they just recommend using VALSET, VALGET, and VALDEL
12+
commands instead. This example shows how to use this new command structure.
13+
14+
Feel like supporting open source hardware?
15+
Buy a board from SparkFun!
16+
ZED-F9P RTK2: https://www.sparkfun.com/products/15136
17+
NEO-M8P RTK: https://www.sparkfun.com/products/15005
18+
SAM-M8Q: https://www.sparkfun.com/products/15106
19+
20+
Hardware Connections:
21+
Plug a Qwiic cable into the GPS and a RedBoard Qwiic or BlackBoard
22+
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
23+
Open the serial monitor at 115200 baud to see the output
24+
*/
25+
26+
#include <Wire.h> //Needed for I2C to GPS
27+
28+
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
29+
SFE_UBLOX_GPS myGPS;
30+
31+
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to Ublox module.
32+
33+
void setup()
34+
{
35+
Serial.begin(115200);
36+
while (!Serial); //Wait for user to open terminal
37+
Serial.println("Ublox multi setVal example");
38+
39+
Wire.begin();
40+
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
41+
42+
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
43+
{
44+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
45+
while (1);
46+
}
47+
48+
myGPS.enableDebugging(); //Enable debug messages over Serial (default)
49+
//myGPS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
50+
51+
bool setValueSuccess = true;
52+
53+
//These key values are hard coded. You can obtain them from the ZED-F9P interface description doc
54+
//or from u-center's Messages->CFG->VALSET window. Keys must be 32-bit.
55+
//Choose setVal8, setVal16 or setVal32 depending on the required value data width (1, 2 or 4 bytes)
56+
//L, U1, I1, E1 and X1 values are 8-bit
57+
//U2, I2, E2 and X2 values are 16-bit
58+
//U4, I4, R4, E4, X4 values are 32-bit
59+
60+
setValueSuccess &= myGPS.setVal8(0x10930006, 0); //Enable high precision NMEA (value is 8-bit (L / U1))
61+
//setValueSuccess &= myGPS.setVal16(0x30210001, 100); //Set measurement rate to 100ms (10Hz update rate) (value is 16-bit (U2))
62+
setValueSuccess &= myGPS.setVal16(0x30210001, 1000); //Set measurement rate to 1000ms (1Hz update rate) (value is 16-bit (U2))
63+
64+
//Below is the original way we enabled a single RTCM message on the I2C port. After that, we show how to do the same
65+
//but with multiple messages all in one go using newCfgValset, addCfgValset and sendCfgValset.
66+
//Original: myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
67+
68+
//Begin with newCfgValset8/16/32
69+
setValueSuccess &= myGPS.newCfgValset8(0x209102bd, 1); //Set output rate of msg 1005 over the I2C port to once per measurement (value is 8-bit (U1))
70+
//Add extra keyIDs and values using addCfgValset8/16/32
71+
setValueSuccess &= myGPS.addCfgValset8(0x209102cc, 1); //Set output rate of msg 1077 over the I2C port to once per measurement (value is 8-bit (U1))
72+
setValueSuccess &= myGPS.addCfgValset8(0x209102d1, 1); //Set output rate of msg 1087 over the I2C port to once per measurement (value is 8-bit (U1))
73+
setValueSuccess &= myGPS.addCfgValset8(0x209102d6, 1); //Set output rate of msg 1127 over the I2C port to once per measurement (value is 8-bit (U1))
74+
setValueSuccess &= myGPS.addCfgValset8(0x20910318, 1); //Set output rate of msg 1097 over the I2C port to once per measurement (value is 8-bit (U1))
75+
// Add the final value and send the packet using sendCfgValset8/16/32
76+
setValueSuccess &= myGPS.sendCfgValset8(0x20910303, 10); //Set output rate of msg 1230 over the I2C port to once every 10 measurements (value is 8-bit (U1))
77+
78+
if(setValueSuccess == true)
79+
{
80+
Serial.println("Values were successfully set");
81+
}
82+
else
83+
Serial.println("Value set failed");
84+
85+
}
86+
87+
void loop()
88+
{
89+
90+
}

keywords.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ setSPIOutput KEYWORD2
6363

6464
getVal8 KEYWORD2
6565
setVal KEYWORD2
66+
setVal8 KEYWORD2
67+
setVal16 KEYWORD2
68+
setVal32 KEYWORD2
69+
newCfgValset8 KEYWORD2
70+
newCfgValset16 KEYWORD2
71+
newCfgValset32 KEYWORD2
72+
addCfgValset8 KEYWORD2
73+
addCfgValset16 KEYWORD2
74+
addCfgValset32 KEYWORD2
75+
sendCfgValset8 KEYWORD2
76+
sendCfgValset16 KEYWORD2
77+
sendCfgValset32 KEYWORD2
6678

6779
getSurveyMode KEYWORD2
6880
setSurveyMode KEYWORD2

0 commit comments

Comments
 (0)