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

Commit e0eb2b3

Browse files
authored
Merge branch 'master' into multiSetVal-revisited-(Issue-#20-#21-#23)
2 parents 61ab2e9 + 50e2af8 commit e0eb2b3

File tree

11 files changed

+730
-161
lines changed

11 files changed

+730
-161
lines changed

ISSUE_TEMPLATE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
### Subject of the issue
2+
Describe your issue here. If you reference a datasheet please specify which one and in which section (ie, the protocol manual, section 5.1.2). Additionally, screenshots are easy to paste into github.
3+
4+
### Your workbench
5+
* What development board or microcontroller are you using?
6+
* What version of hardware or breakout board are you using?
7+
* How is the breakout board wired to your microcontroller?
8+
* How is everything being powered?
9+
* Are there any additional details that may help us help you?
10+
11+
### Steps to reproduce
12+
Tell us how to reproduce this issue. Please post stripped down example code demonstrating your issue.
13+
14+
### Expected behavior
15+
Tell us what should happen
16+
17+
### Actual behavior
18+
Tell us what happens instead

examples/Example14_DebugOutput/Example14_DebugOutput.ino

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,19 @@ void loop()
7575
Serial.print(F(" SIV: "));
7676
Serial.print(SIV);
7777

78+
Serial.println();
79+
Serial.print(myGPS.getYear());
80+
Serial.print("-");
81+
Serial.print(myGPS.getMonth());
82+
Serial.print("-");
83+
Serial.print(myGPS.getDay());
84+
Serial.print(" ");
85+
Serial.print(myGPS.getHour());
86+
Serial.print(":");
87+
Serial.print(myGPS.getMinute());
88+
Serial.print(":");
89+
Serial.println(myGPS.getSecond());
90+
7891
Serial.println();
7992
}
8093
}

examples/Example15_GetDateTime/Example15_GetDateTime.ino

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
basically do whatever you want with this code.
88
99
This example shows how to query a Ublox module for the current time and date. We also
10-
turn off the NMEA output on the I2C port. This decreases the amount of I2C traffic
10+
turn off the NMEA output on the I2C port. This decreases the amount of I2C traffic
1111
dramatically.
1212
1313
Leave NMEA parsing behind. Now you can simply ask the module for the datums you want!
@@ -33,63 +33,63 @@ long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to Ublox m
3333

3434
void setup()
3535
{
36-
Serial.begin(115200);
37-
while (!Serial)
38-
; //Wait for user to open terminal
39-
Serial.println("SparkFun Ublox Example");
40-
41-
Wire.begin();
42-
43-
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
44-
{
45-
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
46-
while (1)
47-
;
48-
}
49-
50-
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
51-
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
36+
Serial.begin(115200);
37+
while (!Serial)
38+
; //Wait for user to open terminal
39+
Serial.println("SparkFun Ublox Example");
40+
41+
Wire.begin();
42+
43+
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
44+
{
45+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
46+
while (1)
47+
;
48+
}
49+
50+
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
51+
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
5252
}
5353

5454
void loop()
5555
{
56-
//Query module only every second. Doing it more often will just cause I2C traffic.
57-
//The module only responds when a new position is available
58-
if (millis() - lastTime > 1000)
59-
{
60-
lastTime = millis(); //Update the timer
61-
62-
long latitude = myGPS.getLatitude();
63-
Serial.print(F("Lat: "));
64-
Serial.print(latitude);
65-
66-
long longitude = myGPS.getLongitude();
67-
Serial.print(F(" Long: "));
68-
Serial.print(longitude);
69-
Serial.print(F(" (degrees * 10^-7)"));
70-
71-
long altitude = myGPS.getAltitude();
72-
Serial.print(F(" Alt: "));
73-
Serial.print(altitude);
74-
Serial.print(F(" (mm)"));
75-
76-
byte SIV = myGPS.getSIV();
77-
Serial.print(F(" SIV: "));
78-
Serial.print(SIV);
79-
80-
Serial.println();
81-
Serial.print(myGPS.getYear());
82-
Serial.print("-");
83-
Serial.print(myGPS.getMonth());
84-
Serial.print("-");
85-
Serial.print(myGPS.getDay());
86-
Serial.print(" ");
87-
Serial.print(myGPS.getHour());
88-
Serial.print(":");
89-
Serial.print(myGPS.getMinute());
90-
Serial.print(":");
91-
Serial.println(myGPS.getSecond());
92-
93-
Serial.println();
94-
}
56+
//Query module only every second. Doing it more often will just cause I2C traffic.
57+
//The module only responds when a new position is available
58+
if (millis() - lastTime > 1000)
59+
{
60+
lastTime = millis(); //Update the timer
61+
62+
long latitude = myGPS.getLatitude();
63+
Serial.print(F("Lat: "));
64+
Serial.print(latitude);
65+
66+
long longitude = myGPS.getLongitude();
67+
Serial.print(F(" Long: "));
68+
Serial.print(longitude);
69+
Serial.print(F(" (degrees * 10^-7)"));
70+
71+
long altitude = myGPS.getAltitude();
72+
Serial.print(F(" Alt: "));
73+
Serial.print(altitude);
74+
Serial.print(F(" (mm)"));
75+
76+
byte SIV = myGPS.getSIV();
77+
Serial.print(F(" SIV: "));
78+
Serial.print(SIV);
79+
80+
Serial.println();
81+
Serial.print(myGPS.getYear());
82+
Serial.print("-");
83+
Serial.print(myGPS.getMonth());
84+
Serial.print("-");
85+
Serial.print(myGPS.getDay());
86+
Serial.print(" ");
87+
Serial.print(myGPS.getHour());
88+
Serial.print(":");
89+
Serial.print(myGPS.getMinute());
90+
Serial.print(":");
91+
Serial.println(myGPS.getSecond());
92+
93+
Serial.println();
94+
}
9595
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
Configuring the GPS to automatically send position reports over I2C, with explicit data parsing calls
3+
By: Nathan Seidle Thorsten von Eicken and Felix Jirka
4+
SparkFun Electronics
5+
Date: July 1st, 2019
6+
License: MIT. See license file for more information but you can
7+
basically do whatever you want with this code.
8+
9+
This example shows how to configure the U-Blox GPS the send navigation reports automatically
10+
and retrieving the latest one via checkUblox when available.
11+
This eliminates the implicit update in getPVT when accessing data fields twice.
12+
Also this reduces the memory overhead of a separate buffer while introducing a slight error by inconsistencies because of the unsynchronized updates (on a multi core system).
13+
14+
This can be used over serial or over I2C, this example shows the I2C use. With serial the GPS
15+
simply outputs the UBX_NAV_PVT packet. With I2C it queues it into its internal I2C buffer (4KB in
16+
size?) where it can be retrieved in the next I2C poll.
17+
18+
Feel like supporting open source hardware?
19+
Buy a board from SparkFun!
20+
ZED-F9P RTK2: https://www.sparkfun.com/products/15136
21+
NEO-M8P RTK: https://www.sparkfun.com/products/15005
22+
SAM-M8Q: https://www.sparkfun.com/products/15106
23+
24+
Hardware Connections:
25+
Plug a Qwiic cable into the GPS and a BlackBoard
26+
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
27+
Open the serial monitor at 115200 baud to see the output
28+
*/
29+
30+
#include <Wire.h> //Needed for I2C to GPS
31+
32+
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_Ublox_GPS
33+
SFE_UBLOX_GPS myGPS;
34+
35+
void setup()
36+
{
37+
Serial.begin(115200);
38+
while (!Serial); //Wait for user to open terminal
39+
Serial.println("SparkFun Ublox Example");
40+
41+
Wire.begin();
42+
43+
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
44+
{
45+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
46+
while (1);
47+
}
48+
49+
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
50+
myGPS.setNavigationFrequency(2); //Produce two solutions per second
51+
myGPS.setAutoPVT(true, false); //Tell the GPS to "send" each solution and the lib not to update stale data implicitly
52+
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
53+
}
54+
55+
/*
56+
Calling getPVT would return false now (compare to Example 13 where it would return true), so we just use the data provided
57+
If you are using a threaded OS eg. FreeRTOS on an ESP32, the explicit mode of autoPVT allows you to use the data provided on both cores and inside multiple threads
58+
The data update in background creates an inconsistent state, but that should not cause issues for most applications as they usually won't change the GPS location significantly within a 2Hz - 5Hz update rate.
59+
Also you could oversample (10Hz - 20Hz) the data to smooth out such issues...
60+
*/
61+
void loop()
62+
{
63+
static uint16_t counter = 0;
64+
65+
if (counter % 10 == 0) {
66+
// update your AHRS filter here for a ~100Hz update rate
67+
// GPS data will be quasi static but data from your IMU will be changing
68+
}
69+
// debug output each half second
70+
if (counter % 500 == 0) {
71+
Serial.println();
72+
long latitude = myGPS.getLatitude();
73+
Serial.print(F("Lat: "));
74+
Serial.print(latitude);
75+
76+
long longitude = myGPS.getLongitude();
77+
Serial.print(F(" Long: "));
78+
Serial.print(longitude);
79+
Serial.print(F(" (degrees * 10^-7)"));
80+
81+
long altitude = myGPS.getAltitude();
82+
Serial.print(F(" Alt: "));
83+
Serial.print(altitude);
84+
Serial.print(F(" (mm)"));
85+
86+
byte SIV = myGPS.getSIV();
87+
Serial.print(F(" SIV: "));
88+
Serial.print(SIV);
89+
90+
Serial.println();
91+
}
92+
// call checkUblox all 50ms to capture the gps data
93+
if (counter % 50 == 0) {
94+
myGPS.checkUblox();
95+
}
96+
delay(1);
97+
counter++;
98+
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
Getting time and date using Ublox commands
3+
By: davidallenmann
4+
SparkFun Electronics
5+
Date: April 16th, 2019
6+
License: MIT. See license file for more information but you can
7+
basically do whatever you want with this code.
8+
9+
This example shows how to query a Ublox module for the current time and date. We also
10+
turn off the NMEA output on the I2C port. This decreases the amount of I2C traffic
11+
dramatically.
12+
13+
Leave NMEA parsing behind. Now you can simply ask the module for the datums you want!
14+
15+
Feel like supporting open source hardware?
16+
Buy a board from SparkFun!
17+
ZED-F9P RTK2: https://www.sparkfun.com/products/15136
18+
NEO-M8P RTK: https://www.sparkfun.com/products/15005
19+
SAM-M8Q: https://www.sparkfun.com/products/15106
20+
21+
Hardware Connections:
22+
Plug a Qwiic cable into the GPS and a BlackBoard
23+
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
24+
Open the serial monitor at 115200 baud to see the output
25+
*/
26+
27+
#include <Wire.h> //Needed for I2C to GPS
28+
29+
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
30+
SFE_UBLOX_GPS myGPS;
31+
32+
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to Ublox module.
33+
34+
void setup()
35+
{
36+
Serial.begin(500000); //Increase serial speed to maximize
37+
while (!Serial)
38+
; //Wait for user to open terminal
39+
Serial.println("SparkFun Ublox Example");
40+
41+
Wire.begin();
42+
Wire.setClock(400000);
43+
44+
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
45+
{
46+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
47+
while (1)
48+
;
49+
}
50+
51+
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
52+
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
53+
54+
//myGPS.enableDebugging(); //Enable debug messages over Serial (default)
55+
56+
myGPS.setNavigationFrequency(10); //Set output to 10 times a second
57+
byte rate = myGPS.getNavigationFrequency(); //Get the update rate of this module
58+
Serial.print("Current update rate:");
59+
Serial.println(rate);
60+
61+
}
62+
63+
void loop()
64+
{
65+
//Query module only every second. Doing it more often will just cause I2C traffic.
66+
//The module only responds when a new position is available
67+
if (millis() - lastTime > 10)
68+
{
69+
lastTime = millis(); //Update the timer
70+
71+
long latitude = myGPS.getLatitude();
72+
Serial.print(F("Lat: "));
73+
Serial.print(latitude);
74+
75+
long longitude = myGPS.getLongitude();
76+
Serial.print(F(" Long: "));
77+
Serial.print(longitude);
78+
Serial.print(F(" (degrees * 10^-7)"));
79+
80+
long altitude = myGPS.getAltitude();
81+
Serial.print(F(" Alt: "));
82+
Serial.print(altitude);
83+
Serial.print(F(" (mm)"));
84+
85+
byte SIV = myGPS.getSIV();
86+
Serial.print(F(" SIV: "));
87+
Serial.print(SIV);
88+
89+
Serial.print(myGPS.getYear());
90+
Serial.print("-");
91+
Serial.print(myGPS.getMonth());
92+
Serial.print("-");
93+
Serial.print(myGPS.getDay());
94+
Serial.print(" ");
95+
Serial.print(myGPS.getHour());
96+
Serial.print(":");
97+
Serial.print(myGPS.getMinute());
98+
Serial.print(":");
99+
Serial.print(myGPS.getSecond());
100+
Serial.print(".");
101+
Serial.print(myGPS.getNanosecond());
102+
103+
Serial.println();
104+
}
105+
}

0 commit comments

Comments
 (0)