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

Commit 49224fa

Browse files
authored
Merge pull request #137 from sparkfun/release_candidate
v1.8.7 Release candidate
2 parents 2816b95 + 8b27b3e commit 49224fa

File tree

13 files changed

+1274
-162
lines changed

13 files changed

+1274
-162
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/*
2+
Configuring the GPS to automatically send HPPOSLLH position reports over I2C
3+
By: Paul Clark
4+
Date: October 27th 2020
5+
6+
Based on an earlier example:
7+
By: Nathan Seidle and Thorsten von Eicken
8+
SparkFun Electronics
9+
Date: January 3rd, 2019
10+
License: MIT. See license file for more information but you can
11+
basically do whatever you want with this code.
12+
13+
This example shows how to configure the U-Blox GPS the send navigation reports automatically
14+
and retrieving the latest one via getHPPOSLLH. This eliminates the blocking in getHPPOSLLH while the GPS
15+
produces a fresh navigation solution at the expense of returning a slighly old solution.
16+
17+
This can be used over serial or over I2C, this example shows the I2C use. With serial the GPS
18+
simply outputs the UBX_NAV_HPPOSLLH packet. With I2C it queues it into its internal I2C buffer (4KB in
19+
size?) where it can be retrieved in the next I2C poll.
20+
21+
Feel like supporting open source hardware?
22+
Buy a board from SparkFun!
23+
ZED-F9P RTK2: https://www.sparkfun.com/products/15136
24+
NEO-M8P RTK: https://www.sparkfun.com/products/15005
25+
26+
Hardware Connections:
27+
Plug a Qwiic cable into the GPS and a BlackBoard
28+
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
29+
Open the serial monitor at 115200 baud to see the output
30+
*/
31+
32+
#include <Wire.h> //Needed for I2C to GPS
33+
34+
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_Ublox_GPS
35+
SFE_UBLOX_GPS myGPS;
36+
37+
void setup()
38+
{
39+
Serial.begin(115200);
40+
while (!Serial); //Wait for user to open terminal
41+
Serial.println("SparkFun Ublox Example");
42+
43+
Wire.begin();
44+
45+
//myGPS.enableDebugging(); // Uncomment this line to enable lots of helpful debug messages
46+
47+
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
48+
{
49+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
50+
while (1);
51+
}
52+
53+
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
54+
//myGPS.factoryDefault(); delay(5000);
55+
56+
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
57+
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
58+
59+
myGPS.setNavigationFrequency(1); //Produce one solution per second
60+
61+
62+
// The acid test: all four of these combinations should work seamlessly :-)
63+
64+
//myGPS.setAutoPVT(false); // Library will poll each reading
65+
//myGPS.setAutoHPPOSLLH(false); // Library will poll each reading
66+
67+
//myGPS.setAutoPVT(true); // Tell the GPS to "send" each solution automatically
68+
//myGPS.setAutoHPPOSLLH(false); // Library will poll each reading
69+
70+
//myGPS.setAutoPVT(false); // Library will poll each reading
71+
//myGPS.setAutoHPPOSLLH(true); // Tell the GPS to "send" each hi res solution automatically
72+
73+
myGPS.setAutoPVT(true); // Tell the GPS to "send" each solution automatically
74+
myGPS.setAutoHPPOSLLH(true); // Tell the GPS to "send" each hi res solution automatically
75+
}
76+
77+
void loop()
78+
{
79+
// Calling getHPPOSLLH returns true if there actually is a fresh navigation solution available.
80+
// Calling getPVT returns true if there actually is a fresh navigation solution available.
81+
if ((myGPS.getHPPOSLLH()) || (myGPS.getPVT()))
82+
{
83+
Serial.println();
84+
85+
long highResLatitude = myGPS.getHighResLatitude();
86+
Serial.print(F("Hi Res Lat: "));
87+
Serial.print(highResLatitude);
88+
89+
int highResLatitudeHp = myGPS.getHighResLatitudeHp();
90+
Serial.print(F(" "));
91+
Serial.print(highResLatitudeHp);
92+
93+
long highResLongitude = myGPS.getHighResLongitude();
94+
Serial.print(F(" Hi Res Long: "));
95+
Serial.print(highResLongitude);
96+
97+
int highResLongitudeHp = myGPS.getHighResLongitudeHp();
98+
Serial.print(F(" "));
99+
Serial.print(highResLongitudeHp);
100+
101+
unsigned long horizAccuracy = myGPS.getHorizontalAccuracy();
102+
Serial.print(F(" Horiz accuracy: "));
103+
Serial.print(horizAccuracy);
104+
105+
long latitude = myGPS.getLatitude();
106+
Serial.print(F(" Lat: "));
107+
Serial.print(latitude);
108+
109+
long longitude = myGPS.getLongitude();
110+
Serial.print(F(" Long: "));
111+
Serial.println(longitude);
112+
}
113+
else
114+
{
115+
Serial.print(".");
116+
delay(50);
117+
}
118+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
Set the static position of the receiver.
3+
By: SparkFun Electronics / Nathan Seidle
4+
Date: September 26th, 2020
5+
License: MIT. See license file for more information but you can
6+
basically do whatever you want with this code.
7+
8+
This example shows how to set the static position of a receiver
9+
using an Earth-Centered, Earth-Fixed (ECEF) location. This is the
10+
output from a long (24 hour+) survey-in. Setting the static position
11+
immediately causes the receiver to begin outputting RTCM data (if
12+
enabled), perfect for setting up your own RTCM NTRIP caster or CORS.
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+
19+
Hardware Connections:
20+
Plug a Qwiic cable into the GPS and a BlackBoard
21+
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
22+
Open the serial monitor at 115200 baud to see the output
23+
*/
24+
25+
#include <Wire.h> //Needed for I2C to GPS
26+
27+
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
28+
SFE_UBLOX_GPS myGPS;
29+
30+
void setup()
31+
{
32+
Serial.begin(115200); // You may need to increase this for high navigation rates!
33+
while (!Serial)
34+
; //Wait for user to open terminal
35+
Serial.println(F("SparkFun u-blox Example"));
36+
37+
Wire.begin();
38+
39+
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages
40+
41+
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
42+
{
43+
Serial.println(F("u-blox GPS not detected at default I2C address. Please check wiring. Freezing."));
44+
while (1)
45+
;
46+
}
47+
48+
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
49+
50+
//-1280208.308,-4716803.847,4086665.811 is SparkFun HQ so...
51+
52+
//Units are cm so 1234 = 12.34m
53+
//myGPS.setStaticPosition(-128020831, -471680385, 408666581);
54+
55+
//Units are cm with a high precision extension so -1234.5678 should be called: (-123456, -78)
56+
myGPS.setStaticPosition(-128020830, -80, -471680384, -70, 408666581, 10); //With high precision 0.1mm parts
57+
58+
//We can also set via lat/long
59+
//40.09029751,-105.18507900,1560.238
60+
//myGPS.setStaticPosition(400902975, -1051850790, 156024, true); //True at end enables lat/long input
61+
//myGPS.setStaticPosition(400902975, 10, -1051850790, 0, 156023, 80, true);
62+
63+
//Now let's use getVals to read back the data
64+
//long ecefX = myGPS.getVal32(0x40030003);
65+
//Serial.print("ecefX: ");
66+
//Serial.println(ecefX);
67+
68+
Serial.println(F("Done!"));
69+
}
70+
71+
void loop()
72+
{
73+
}

Diff for: examples/ZED-F9P/Example6_GetVal/Example6_GetVal.ino

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
2-
Send UBX binary commands to enable RTCM sentences on Ublox ZED-F9P module
2+
Get a device's I2C address using advanced getVal method
33
By: Nathan Seidle
44
SparkFun Electronics
55
Date: January 9th, 2019
66
License: MIT. See license file for more information but you can
77
basically do whatever you want with this code.
88
9-
Ublox changed how to configure their modules in 2019. As of version 23 of the UBX protocol the
9+
u-blox changed how to configure their modules in 2019. As of version 23 of the UBX protocol the
1010
UBX-CFG commands are deprecated; they still work, they just recommend using VALSET, VALGET, and VALDEL
1111
commands instead. This example shows how to use this new command structure.
1212
@@ -32,27 +32,29 @@ long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to Ublox m
3232
void setup()
3333
{
3434
Serial.begin(115200);
35-
while (!Serial); //Wait for user to open terminal
36-
Serial.println("Ublox getVal example");
35+
while (!Serial)
36+
; //Wait for user to open terminal
37+
Serial.println("u-blox getVal example");
3738

3839
Wire.begin();
3940
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
4041

4142
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
4243
{
43-
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
44-
while (1);
44+
Serial.println(F("u-blox GPS not detected at default I2C address. Please check wiring. Freezing."));
45+
while (1)
46+
;
4547
}
4648

4749
myGPS.enableDebugging(); //Enable debug messages over Serial (default)
4850
//myGPS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
4951

50-
uint8_t currentI2Caddress = myGPS.getVal8(0x20510001);
52+
uint8_t currentI2Caddress = myGPS.getVal8(UBLOX_CFG_I2C_ADDRESS);
5153
Serial.print("Current I2C address (should be 0x42): 0x");
5254
Serial.println(currentI2Caddress >> 1, HEX); //Ublox module returns a shifted 8-bit address. Make it 7-bit unshifted.
5355

54-
while(1);
55-
56+
while (1)
57+
;
5658
}
5759

5860
void loop()
@@ -83,4 +85,4 @@ void loop()
8385

8486
Serial.println();
8587
}
86-
}
88+
}

Diff for: examples/ZED-F9P/Example7_SetVal/Example7_SetVal.ino

+16-15
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
2-
Send UBX binary commands to enable RTCM sentences on Ublox ZED-F9P module
2+
Send UBX binary commands to enable RTCM sentences on u-blox ZED-F9P module
33
By: Nathan Seidle
44
SparkFun Electronics
55
Date: January 9th, 2019
66
License: MIT. See license file for more information but you can
77
basically do whatever you want with this code.
88
9-
Ublox changed how to configure their modules in 2019. As of version 23 of the UBX protocol the
9+
u-blox changed how to configure their modules in 2019. As of version 23 of the UBX protocol the
1010
UBX-CFG commands are deprecated; they still work, they just recommend using VALSET, VALGET, and VALDEL
1111
commands instead. This example shows how to use this new command structure.
1212
@@ -27,49 +27,50 @@
2727
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
2828
SFE_UBLOX_GPS myGPS;
2929

30-
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to Ublox module.
30+
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
3131

3232
void setup()
3333
{
3434
Serial.begin(115200);
35-
while (!Serial); //Wait for user to open terminal
36-
Serial.println("Ublox getVal example");
35+
while (!Serial)
36+
; //Wait for user to open terminal
37+
Serial.println("u-blox getVal example");
3738

3839
Wire.begin();
3940
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
4041

41-
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
42+
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
4243
{
43-
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
44-
while (1);
44+
Serial.println(F("u-blox GPS not detected at default I2C address. Please check wiring. Freezing."));
45+
while (1)
46+
;
4547
}
4648

4749
myGPS.enableDebugging(); //Enable debug messages over Serial (default)
4850
//myGPS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
4951

5052
bool setValueSuccess;
5153

52-
//These key values are hard coded. You can obtain them from the ZED-F9P interface description doc
54+
//These key values are hard coded and defined in u-blox_config_keys.h.
55+
//You can obtain them from the ZED-F9P interface description doc
5356
//or from u-center's Messages->CFG->VALSET window. Keys must be 32-bit.
54-
//setValueSuccess = myGPS.setVal(0x10930006, 0); //Enable high precision NMEA
55-
setValueSuccess = myGPS.setVal(0x30210001, 100); //Set measurement rate to 100ms (10Hz update rate)
56-
//setValueSuccess = myGPS.setVal(0x30210001, 1000); //Set measurement rate to 1000ms (1Hz update rate)
57+
//setValueSuccess = myGPS.setVal(UBLOX_CFG_NMEA_HIGHPREC, 0); //Enable high precision NMEA
58+
setValueSuccess = myGPS.setVal(UBLOX_CFG_RATE_MEAS, 100); //Set measurement rate to 100ms (10Hz update rate)
59+
//setValueSuccess = myGPS.setVal(UBLOX_CFG_RATE_MEAS, 1000); //Set measurement rate to 1000ms (1Hz update rate)
5760

5861
//Below is the original way we enabled the RTCM message on the I2C port. After that, we show how to do the same
5962
//but with setVal().
6063
//Original: myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
6164
//setValueSuccess = myGPS.setVal(0x209102bd, 1); //Set output rate of msg 1005 over the I2C port to once per second
6265

63-
if(setValueSuccess == true)
66+
if (setValueSuccess == true)
6467
{
6568
Serial.println("Value was successfully set");
6669
}
6770
else
6871
Serial.println("Value set failed");
69-
7072
}
7173

7274
void loop()
7375
{
74-
7576
}

0 commit comments

Comments
 (0)