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
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
21- #include < Wire.h> // Needed for I2C to GPS
22-
2332#include < SparkFun_u-blox_GNSS_v3.h> // http://librarymanager/All#SparkFun_u-blox_GNSS_v3
24- SFE_UBLOX_GNSS myGNSS;
33+ SFE_UBLOX_GNSS_SERIAL myGNSS;
2534
2635// Callback: newRAWX will be called when new RXM RAWX data arrives
2736// See u-blox_structs.h for the full definition of UBX_RXMRAWX_data_t
@@ -209,9 +218,9 @@ void newRAWX(UBX_RXM_RAWX_data_t *ubxDataStruct)
209218 else if (ubxDataStruct->blocks [block].svId < 100 ) sprintf (&SV[14 ], " %d " , ubxDataStruct->blocks [block].svId ); // Align the svId
210219 else sprintf (&SV[14 ], " %d " , ubxDataStruct->blocks [block].svId ); // Align the svId
211220
212- if (ubxDataStruct->blocks [block].cno < 10 ) sprintf (&SV[18 ], " %d " , ubxDataStruct->blocks [block].cno ); // Align the svId
213- else if (ubxDataStruct->blocks [block].cno < 100 ) sprintf (&SV[18 ], " %d " , ubxDataStruct->blocks [block].cno ); // Align the svId
214- else sprintf (&SV[18 ], " %d " , ubxDataStruct->blocks [block].cno ); // Align the svId
221+ if (ubxDataStruct->blocks [block].cno < 10 ) sprintf (&SV[18 ], " %d " , ubxDataStruct->blocks [block].cno ); // Align the cno
222+ else if (ubxDataStruct->blocks [block].cno < 100 ) sprintf (&SV[18 ], " %d " , ubxDataStruct->blocks [block].cno ); // Align the cno
223+ else sprintf (&SV[18 ], " %d " , ubxDataStruct->blocks [block].cno ); // Align the cno
215224
216225 // Print cno as a bar chart
217226 uint8_t cno;
@@ -231,25 +240,50 @@ void setup()
231240 while (!Serial); // Wait for user to open terminal
232241 Serial.println (" SparkFun u-blox Example" );
233242
234- Wire .begin ();
243+ Serial1 .begin (38400 ); // The NEO-F10N defaults to 38400 baud
235244
236245 // myGNSS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
237246
238- if (myGNSS.begin () == false ) // Connect to the u-blox module using Wire port
247+ while (myGNSS.begin (Serial1 ) == false ) // Connect to the u-blox module using Serial1 (UART)
239248 {
240- Serial.println (F (" u-blox GNSS not detected at default I2C address . Please check wiring. Freezing ." ));
241- while ( 1 );
249+ Serial.println (F (" u-blox GNSS not detected. Please check wiring. Retrying.. ." ));
250+ delay ( 1000 );
242251 }
243252
244- myGNSS.setGPSL5HealthOverride (true ); // Mark L5 signals as healthy - store in RAM and BBR
253+ if (myGNSS.getModuleInfo ())
254+ {
255+ Serial.print (F (" FWVER: " ));
256+ Serial.print (myGNSS.getFirmwareVersionHigh ()); // Returns uint8_t
257+ Serial.print (F (" ." ));
258+ Serial.println (myGNSS.getFirmwareVersionLow ()); // Returns uint8_t
259+
260+ Serial.print (F (" Firmware: " ));
261+ Serial.println (myGNSS.getFirmwareType ()); // Returns HPG, SPG, SPGL1L5 etc. as (const char *)
245262
246- myGNSS.setLNAMode (SFE_UBLOX_LNA_MODE_NORMAL); // Set the LNA gain to normal (full). Other options: LOWGAIN, BYPASS
263+ Serial.print (F (" PROTVER: " ));
264+ Serial.print (myGNSS.getProtocolVersionHigh ()); // Returns uint8_t
265+ Serial.print (F (" ." ));
266+ Serial.println (myGNSS.getProtocolVersionLow ()); // Returns uint8_t
267+
268+ Serial.print (F (" MOD: " ));
269+ Serial.println (myGNSS.getModuleName ()); // Returns ZED-F9P, MAX-M10S etc. as (const char *)
270+ }
271+ else
272+ Serial.println (F (" Error: could not read module info!" ));
247273
248- myGNSS.setI2COutput (COM_TYPE_UBX); // Set the I2C port to output UBX only (turn off NMEA noise)
274+ myGNSS.setUART1Output (COM_TYPE_UBX); // Set the UART1 port to output UBX only (turn off NMEA noise)
249275 myGNSS.saveConfigSelective (VAL_CFG_SUBSEC_IOPORT); // Save (only) the communications port settings to flash and BBR
250276
251277 myGNSS.setMeasurementRate (5000 ); // Produce one solution every five seconds (RAWX produces a _lot_ of data!)
252278
279+ myGNSS.setVal8 (UBLOX_CFG_SIGNAL_GPS_L5_ENA, 1 ); // Make sure the GPS L5 band is enabled (needed on the NEO-F9P)
280+
281+ myGNSS.setGPSL5HealthOverride (true ); // Mark L5 signals as healthy - store in RAM and BBR
282+
283+ myGNSS.setLNAMode (SFE_UBLOX_LNA_MODE_NORMAL); // Set the LNA gain to normal (full). Other options: LOWGAIN, BYPASS
284+
285+ myGNSS.softwareResetGNSSOnly (); // Restart the GNSS to apply the L5 health override
286+
253287 myGNSS.setAutoRXMRAWXcallbackPtr (&newRAWX); // Enable automatic RXM RAWX messages with callback to newRAWX
254288}
255289
@@ -258,6 +292,15 @@ void loop()
258292 myGNSS.checkUblox (); // Check for the arrival of new data and process it.
259293 myGNSS.checkCallbacks (); // Check if any callbacks are waiting to be processed.
260294
261- Serial.print (" ." );
262- delay (50 );
295+ printDot ();
296+ }
297+
298+ void printDot () // Print a dot every 200ms - without using delay
299+ {
300+ static unsigned long lastPrint = millis ();
301+ if (millis () > (lastPrint + 200 ))
302+ {
303+ Serial.print (" ." );
304+ lastPrint = millis ();
305+ }
263306}
0 commit comments