Skip to content

Commit 4219249

Browse files
committed
Update F10N & F9P examples
1 parent 159e98d commit 4219249

File tree

2 files changed

+322
-11
lines changed

2 files changed

+322
-11
lines changed

examples/NEO-F10N/Example1_RAWX/Example1_RAWX.ino

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Configuring the NEO-F10N GNSS to send RXM RAWX reports over I2C and display them using a callback
2+
Configuring the NEO-F10N GNSS to send RXM RAWX reports over Serial and display them using a callback
33
By: Paul Clark
44
SparkFun Electronics
55
Date: November 24th, 2023
@@ -8,20 +8,31 @@
88
This example shows how to configure the u-blox NEO-F10N GNSS to send RXM RAWX reports automatically
99
and access the data via a callback. It also demonstrates how to mark the L5 signals as healthy.
1010
11+
Note: the NEO-F10N only supports UART1. It does not support I2C, SPI or built-in USB.
12+
To run this example on the SparkFun NEO-F10N breakout, you need to open the USB-TX and USB-RX jumpers
13+
to isolate the on-board CH340 USB interface chip. See Hardware Connections below.
14+
15+
Note: the engineering sample of the NEO-F10N-00B supports RXM-RAWX. Production firmware may not.
16+
1117
Feel like supporting open source hardware?
1218
Buy a board from SparkFun!
1319
NEO-F10N: https://www.sparkfun.com/products/24114
1420
1521
Hardware Connections:
16-
Plug a Qwiic cable into the GPS and a BlackBoard
17-
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 USB-TX and USB-RX jumpers to isolate the on-board CH340 USB interface chip.
23+
Solder header pins (9-way) to the board so you can access the UART1 TX and RX connections.
24+
Use jumper wires to connect:
25+
* TX to Serial1 RX on your Arduino board.
26+
* RX to Serial1 TX on your Arduino board.
27+
* GND to GND
28+
* 5V to 5V (or 3V3 to 3V3)
1829
Open the serial monitor at 115200 baud to see the output
1930
*/
2031

2132
#include <Wire.h> //Needed for I2C to GPS
2233

2334
#include <SparkFun_u-blox_GNSS_v3.h> //http://librarymanager/All#SparkFun_u-blox_GNSS_v3
24-
SFE_UBLOX_GNSS myGNSS;
35+
SFE_UBLOX_GNSS_SERIAL myGNSS;
2536

2637
// Callback: newRAWX will be called when new RXM RAWX data arrives
2738
// See u-blox_structs.h for the full definition of UBX_RXMRAWX_data_t
@@ -231,17 +242,43 @@ void setup()
231242
while (!Serial); //Wait for user to open terminal
232243
Serial.println("SparkFun u-blox Example");
233244

234-
Wire.begin();
245+
Serial1.begin(38400); // The NEO-F10N defaults to 38400 baud
235246

236247
//myGNSS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
237248

238-
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
249+
while (myGNSS.begin(Serial1) == false) //Connect to the u-blox module using Serial1 (UART)
250+
{
251+
Serial.println(F("u-blox GNSS not detected. Please check wiring. Retrying..."));
252+
delay(1000);
253+
}
254+
255+
if (myGNSS.getModuleInfo())
239256
{
240-
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
241-
while (1);
257+
Serial.print(F("FWVER: "));
258+
Serial.print(myGNSS.getFirmwareVersionHigh()); // Returns uint8_t
259+
Serial.print(F("."));
260+
Serial.println(myGNSS.getFirmwareVersionLow()); // Returns uint8_t
261+
262+
Serial.print(F("Firmware: "));
263+
Serial.println(myGNSS.getFirmwareType()); // Returns HPG, SPG etc. as (const char *)
264+
265+
Serial.print(F("PROTVER: "));
266+
Serial.print(myGNSS.getProtocolVersionHigh()); // Returns uint8_t
267+
Serial.print(F("."));
268+
Serial.println(myGNSS.getProtocolVersionLow()); // Returns uint8_t
269+
270+
Serial.print(F("MOD: "));
271+
Serial.println(myGNSS.getModuleName()); // Returns ZED-F9P, MAX-M10S etc. as (const char *)
242272
}
273+
else
274+
Serial.println(F("Error: could not read module info!"));
243275

244-
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
276+
// Use the helper method to read the unique chip ID as a string
277+
// Returns "000000000000" if the read fails
278+
Serial.print(F("Unique chip ID: 0x"));
279+
Serial.println(myGNSS.getUniqueChipIdStr());
280+
281+
myGNSS.setUART1Output(COM_TYPE_UBX); //Set the UART1 port to output UBX only (turn off NMEA noise)
245282
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
246283

247284
myGNSS.setMeasurementRate(5000); //Produce one solution every five seconds (RAWX produces a _lot_ of data!)
@@ -262,6 +299,15 @@ void loop()
262299
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
263300
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
264301

265-
Serial.print(".");
266-
delay(200);
302+
printDot();
303+
}
304+
305+
void printDot() // Print a dot every 200ms - without using delay
306+
{
307+
static unsigned long lastPrint = millis();
308+
if (millis() > (lastPrint + 200))
309+
{
310+
Serial.print(".");
311+
lastPrint = millis();
312+
}
267313
}
Lines changed: 265 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
/*
2+
Configuring the NEO-F9P GNSS to send RXM RAWX reports over I2C and display them using a callback
3+
By: Paul Clark
4+
SparkFun Electronics
5+
Date: November 24th, 2023
6+
License: MIT. See license file for more information.
7+
8+
This example shows how to configure the u-blox NEO-F9P GNSS to send RXM RAWX reports automatically
9+
and access the data via a callback. It also demonstrates how to mark the L5 signals as healthy.
10+
11+
Feel like supporting open source hardware?
12+
Buy a board from SparkFun!
13+
NEO-F9P: https://www.sparkfun.com/products/23288
14+
15+
Hardware Connections:
16+
Plug a Qwiic cable into the GPS and a BlackBoard
17+
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
18+
Open the serial monitor at 115200 baud to see the output
19+
*/
20+
21+
#include <Wire.h> //Needed for I2C to GPS
22+
23+
#include <SparkFun_u-blox_GNSS_v3.h> //http://librarymanager/All#SparkFun_u-blox_GNSS_v3
24+
SFE_UBLOX_GNSS myGNSS;
25+
26+
// Callback: newRAWX will be called when new RXM RAWX data arrives
27+
// See u-blox_structs.h for the full definition of UBX_RXMRAWX_data_t
28+
// _____ You can use any name you like for the callback. Use the same name when you call setAutoRXMRAWXcallback
29+
// / _____ This _must_ be UBX_RXM_RAWX_data_t
30+
// | / _____ You can use any name you like for the struct
31+
// | | /
32+
// | | |
33+
void newRAWX(UBX_RXM_RAWX_data_t *ubxDataStruct)
34+
{
35+
Serial.println();
36+
37+
Serial.print(F("New RAWX data received. It contains "));
38+
Serial.print(ubxDataStruct->header.numMeas); // Print numMeas (Number of measurements / blocks)
39+
Serial.println(F(" data blocks:"));
40+
41+
for (uint8_t block = 0; block < ubxDataStruct->header.numMeas; block++) // For each block
42+
{
43+
char SV[14 + 4 + 4 + 256 + 1]; // Allocate space for sigId plus svId plus cno plus bars plus NULL
44+
switch (ubxDataStruct->blocks[block].gnssId)
45+
{
46+
case 0:
47+
{
48+
switch (ubxDataStruct->blocks[block].sigId)
49+
{
50+
case 0:
51+
sprintf(SV, "GPS L1 C/A ");
52+
break;
53+
case 3:
54+
sprintf(SV, "GPS L2 CL ");
55+
break;
56+
case 4:
57+
sprintf(SV, "GPS L2 CM ");
58+
break;
59+
case 6:
60+
sprintf(SV, "GPS L5 I ");
61+
break;
62+
case 7:
63+
sprintf(SV, "GPS L5 Q ");
64+
break;
65+
default:
66+
sprintf(SV, "GPS Unknown ");
67+
break;
68+
}
69+
}
70+
break;
71+
case 1:
72+
{
73+
switch (ubxDataStruct->blocks[block].sigId)
74+
{
75+
case 0:
76+
sprintf(SV, "SBAS L1 C/A ");
77+
break;
78+
default:
79+
sprintf(SV, "SBAS Unknown ");
80+
break;
81+
}
82+
}
83+
break;
84+
case 2:
85+
{
86+
switch (ubxDataStruct->blocks[block].sigId)
87+
{
88+
case 0:
89+
sprintf(SV, "Galileo E1 C ");
90+
break;
91+
case 1:
92+
sprintf(SV, "Galileo E1 B ");
93+
break;
94+
case 3:
95+
sprintf(SV, "Galileo E5 aI ");
96+
break;
97+
case 4:
98+
sprintf(SV, "Galileo E5 aQ ");
99+
break;
100+
case 5:
101+
sprintf(SV, "Galileo E5 bI ");
102+
break;
103+
case 6:
104+
sprintf(SV, "Galileo E5 bQ ");
105+
break;
106+
default:
107+
sprintf(SV, "GAL Unknown ");
108+
break;
109+
}
110+
}
111+
break;
112+
case 3:
113+
{
114+
switch (ubxDataStruct->blocks[block].sigId)
115+
{
116+
case 0:
117+
sprintf(SV, "BeiDou B1I D1 ");
118+
break;
119+
case 1:
120+
sprintf(SV, "BeiDou B1I D2 ");
121+
break;
122+
case 2:
123+
sprintf(SV, "BeiDou B2I D1 ");
124+
break;
125+
case 3:
126+
sprintf(SV, "BeiDou B2I D2 ");
127+
break;
128+
case 5:
129+
sprintf(SV, "BeiDou B1 Cp ");
130+
break;
131+
case 6:
132+
sprintf(SV, "BeiDou B2 Cd ");
133+
break;
134+
case 7:
135+
sprintf(SV, "BeiDou B2 ap ");
136+
break;
137+
case 8:
138+
sprintf(SV, "BeiDou B2 ad ");
139+
break;
140+
default:
141+
sprintf(SV, "BDS Unknown ");
142+
break;
143+
}
144+
}
145+
break;
146+
case 5:
147+
{
148+
switch (ubxDataStruct->blocks[block].sigId)
149+
{
150+
case 0:
151+
sprintf(SV, "QZSS L1 C/A ");
152+
break;
153+
case 1:
154+
sprintf(SV, "QZSS L1S ");
155+
break;
156+
case 4:
157+
sprintf(SV, "QZSS L2 CM ");
158+
break;
159+
case 5:
160+
sprintf(SV, "QZSS L2 CL ");
161+
break;
162+
case 8:
163+
sprintf(SV, "QZSS L5 I ");
164+
break;
165+
case 9:
166+
sprintf(SV, "QZSS L5 Q ");
167+
break;
168+
default:
169+
sprintf(SV, "QZSS Unknown ");
170+
break;
171+
}
172+
}
173+
break;
174+
case 6:
175+
{
176+
switch (ubxDataStruct->blocks[block].sigId)
177+
{
178+
case 0:
179+
sprintf(SV, "GLONASS L1 OF ");
180+
break;
181+
case 2:
182+
sprintf(SV, "GLONASS L2 OF ");
183+
break;
184+
default:
185+
sprintf(SV, "GLO Unknown ");
186+
break;
187+
}
188+
}
189+
break;
190+
case 7:
191+
{
192+
switch (ubxDataStruct->blocks[block].sigId)
193+
{
194+
case 0:
195+
sprintf(SV, "NavIC L5 A ");
196+
break;
197+
default:
198+
sprintf(SV, "NavIC Unknown ");
199+
break;
200+
}
201+
}
202+
break;
203+
default:
204+
sprintf(SV, "Unknown ");
205+
break;
206+
}
207+
208+
if (ubxDataStruct->blocks[block].svId < 10) sprintf(&SV[14], "%d ", ubxDataStruct->blocks[block].svId); // Align the svId
209+
else if (ubxDataStruct->blocks[block].svId < 100) sprintf(&SV[14], "%d ", ubxDataStruct->blocks[block].svId); // Align the svId
210+
else sprintf(&SV[14], "%d ", ubxDataStruct->blocks[block].svId); // Align the svId
211+
212+
if (ubxDataStruct->blocks[block].cno < 10) sprintf(&SV[18], " %d ", ubxDataStruct->blocks[block].cno); // Align the cno
213+
else if (ubxDataStruct->blocks[block].cno < 100) sprintf(&SV[18], " %d ", ubxDataStruct->blocks[block].cno); // Align the cno
214+
else sprintf(&SV[18], "%d ", ubxDataStruct->blocks[block].cno); // Align the cno
215+
216+
// Print cno as a bar chart
217+
uint8_t cno;
218+
for (cno = 0; cno <= ubxDataStruct->blocks[block].cno; cno++)
219+
SV[22 + cno] = '=';
220+
SV[22 + cno] = 0; // NULL
221+
222+
Serial.println(SV);
223+
}
224+
}
225+
226+
void setup()
227+
{
228+
delay(1000);
229+
230+
Serial.begin(115200);
231+
while (!Serial); //Wait for user to open terminal
232+
Serial.println("SparkFun u-blox Example");
233+
234+
Wire.begin();
235+
236+
//myGNSS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
237+
238+
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
239+
{
240+
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
241+
while (1);
242+
}
243+
244+
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
245+
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
246+
247+
myGNSS.setMeasurementRate(5000); //Produce one solution every five seconds (RAWX produces a _lot_ of data!)
248+
249+
myGNSS.setVal8(UBLOX_CFG_SIGNAL_GPS_L5_ENA, 1); // Make sure the GPS L5 band is enabled (needed on the NEO-F9P)
250+
251+
myGNSS.setGPSL5HealthOverride(true); // Mark L5 signals as healthy - store in RAM and BBR
252+
253+
myGNSS.softwareResetGNSSOnly(); // Restart the GNSS to apply the L5 health override
254+
255+
myGNSS.setAutoRXMRAWXcallbackPtr(&newRAWX); // Enable automatic RXM RAWX messages with callback to newRAWX
256+
}
257+
258+
void loop()
259+
{
260+
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
261+
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
262+
263+
Serial.print(".");
264+
delay(200);
265+
}

0 commit comments

Comments
 (0)