Skip to content

Commit 5f5c0da

Browse files
authored
Merge pull request #76 from sparkfun/release_candidate
Version 3.1.9
2 parents dce0d86 + e0e61bb commit 5f5c0da

10 files changed

+661
-35
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
/*
2+
Configuring the GNSS to automatically send SEC SIG reports over I2C and display them using a callback
3+
By: Paul Clark
4+
SparkFun Electronics
5+
Date: April 3rd, 2025
6+
License: MIT. See license file for more information.
7+
8+
This example shows how to configure the u-blox GNSS to send SEC SIG reports automatically
9+
and access the data via a callback. No more polling!
10+
11+
Feel like supporting open source hardware?
12+
Buy a board from SparkFun!
13+
ZED-F9P RTK2: https://www.sparkfun.com/products/15136
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: newSECSIG will be called when new SEC SIG data arrives
27+
// See u-blox_structs.h for the full definition of UBX_SEC_SIG_data_t
28+
// _____ You can use any name you like for the callback. Use the same name when you call setAutoSECSIGcallback
29+
// / _____ This _must_ be UBX_SEC_SIG_data_t
30+
// | / _____ You can use any name you like for the struct
31+
// | | /
32+
// | | |
33+
void newSECSIG(UBX_SEC_SIG_data_t *ubxDataStruct)
34+
{
35+
Serial.println();
36+
37+
Serial.print(F("New SEC SIG data received. It contains version "));
38+
Serial.print(ubxDataStruct->version);
39+
Serial.println(F(" data."));
40+
41+
if (ubxDataStruct->version == 1)
42+
{
43+
Serial.print(F("Jamming detection is "));
44+
bool jamDetEnabled = (bool)ubxDataStruct->versions.version1.jamFlags.bits.jamDetEnabled;
45+
Serial.println(jamDetEnabled ? "enabled" : "disabled");
46+
if (jamDetEnabled)
47+
{
48+
Serial.print(F("Jamming state: "));
49+
switch (ubxDataStruct->versions.version1.jamFlags.bits.jammingState)
50+
{
51+
case 1:
52+
Serial.println(F("no jamming indicated"));
53+
break;
54+
case 2:
55+
Serial.println(F("warning (jamming indicated but fix OK)"));
56+
break;
57+
case 3:
58+
Serial.println(F("critical (jamming indicated and no fix)"));
59+
break;
60+
case 0:
61+
default:
62+
Serial.println(F("unknown"));
63+
break;
64+
}
65+
}
66+
Serial.print(F("Spoofing detection is "));
67+
bool spfDetEnabled = (bool)ubxDataStruct->versions.version1.spfFlags.bits.spfDetEnabled;
68+
Serial.println(spfDetEnabled ? "enabled" : "disabled");
69+
if (spfDetEnabled)
70+
{
71+
Serial.print(F("Spoofing state: "));
72+
switch (ubxDataStruct->versions.version1.spfFlags.bits.spoofingState)
73+
{
74+
case 1:
75+
Serial.println(F("no spoofing indicated"));
76+
break;
77+
case 2:
78+
Serial.println(F("spoofing indicated"));
79+
break;
80+
case 3:
81+
Serial.println(F("spoofing affirmed"));
82+
break;
83+
case 0:
84+
default:
85+
Serial.println(F("unknown"));
86+
break;
87+
}
88+
}
89+
}
90+
91+
else if (ubxDataStruct->version == 2)
92+
{
93+
Serial.print(F("Jamming detection is "));
94+
bool jamDetEnabled = (bool)ubxDataStruct->versions.version2.sigSecFlags.bits.jamDetEnabled;
95+
Serial.println(jamDetEnabled ? "enabled" : "disabled");
96+
if (jamDetEnabled)
97+
{
98+
Serial.print(F("Jamming state: "));
99+
switch (ubxDataStruct->versions.version2.sigSecFlags.bits.jamState)
100+
{
101+
case 1:
102+
Serial.println(F("no jamming indicated"));
103+
break;
104+
case 2:
105+
Serial.println(F("warning (jamming indicated)"));
106+
break;
107+
case 0:
108+
default:
109+
Serial.println(F("unknown"));
110+
break;
111+
}
112+
}
113+
Serial.print(F("Spoofing detection is "));
114+
bool spfDetEnabled = (bool)ubxDataStruct->versions.version2.sigSecFlags.bits.spfDetEnabled;
115+
Serial.println(spfDetEnabled ? "enabled" : "disabled");
116+
if (spfDetEnabled)
117+
{
118+
Serial.print(F("Spoofing state: "));
119+
switch (ubxDataStruct->versions.version2.sigSecFlags.bits.spfState)
120+
{
121+
case 1:
122+
Serial.println(F("no spoofing indicated"));
123+
break;
124+
case 2:
125+
Serial.println(F("spoofing indicated"));
126+
break;
127+
case 3:
128+
Serial.println(F("spoofing affirmed"));
129+
break;
130+
case 0:
131+
default:
132+
Serial.println(F("unknown"));
133+
break;
134+
}
135+
}
136+
Serial.print(F("Number of jamming center frequencies: "));
137+
uint8_t jamNumCentFreqs = ubxDataStruct->versions.version2.jamNumCentFreqs;
138+
Serial.println(jamNumCentFreqs);
139+
if (jamNumCentFreqs > 0)
140+
{
141+
for (uint8_t i = 0; i < jamNumCentFreqs; i++)
142+
{
143+
Serial.print(F("Center frequency: "));
144+
Serial.print(ubxDataStruct->versions.version2.jamStateCentFreq[i].bits.centFreq);
145+
Serial.print(F(" kHz "));
146+
if (ubxDataStruct->versions.version2.jamStateCentFreq[i].bits.jammed)
147+
Serial.print("- jammed");
148+
Serial.println();
149+
}
150+
}
151+
}
152+
}
153+
154+
void setup()
155+
{
156+
Serial.begin(115200);
157+
while (!Serial); //Wait for user to open terminal
158+
Serial.println("SparkFun u-blox Example");
159+
160+
Wire.begin();
161+
162+
//myGNSS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
163+
//myGNSS.enableDebugging(Serial, true); // Uncomment this line to enable only the major debug messages on Serial
164+
165+
while (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
166+
{
167+
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring."));
168+
}
169+
170+
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only. Stop the NMEA messages
171+
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
172+
173+
// Just to prove we can, poll the SEC SIG data manually
174+
Serial.println("Polling SEC SIG data:");
175+
UBX_SEC_SIG_data_t secSig;
176+
if (myGNSS.getSECSIG(&secSig))
177+
newSECSIG(&secSig); // Call the callback manually to print the data
178+
else
179+
Serial.println("getSECSIG failed!");
180+
181+
// Now enable automatic (periodic) SEC SIG messages with callback to newSECSIG
182+
myGNSS.setAutoSECSIGcallbackPtr(&newSECSIG);
183+
}
184+
185+
void loop()
186+
{
187+
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
188+
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
189+
190+
Serial.print(".");
191+
delay(50);
192+
}

keys/u-blox-F9-HPS-1.30_InterfaceDescription_UBX-22010984_keys_sorted.txt renamed to keys/u-blox-F9-HPS-1.40_InterfaceDescription_UBXDOC-963802114-13138_keys_sorted.txt

+33-7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
0x101100d7
2323
0x10170001
2424
0x10170002
25+
0x10220001
26+
0x10220002
27+
0x10220003
28+
0x10220004
2529
0x10240012
2630
0x10240020
2731
0x10240030
@@ -120,10 +124,9 @@
120124
0x10a30033
121125
0x10a30034
122126
0x10a30035
123-
0x10c70001
124-
0x10c70002
125127
0x10f60009
126128
0x10f60051
129+
0x10f6005d
127130
0x2005000c
128131
0x20050023
129132
0x20050030
@@ -134,6 +137,7 @@
134137
0x20060016
135138
0x2006001e
136139
0x2006001f
140+
0x20060030
137141
0x2007000b
138142
0x20090009
139143
0x20110011
@@ -150,6 +154,11 @@
150154
0x20140011
151155
0x20210003
152156
0x20210004
157+
0x20220005
158+
0x20220021
159+
0x20220022
160+
0x20220031
161+
0x20220032
153162
0x20240011
154163
0x20240013
155164
0x20240014
@@ -262,6 +271,11 @@
262271
0x2091006c
263272
0x2091006d
264273
0x2091006e
274+
0x2091007e
275+
0x2091007f
276+
0x20910080
277+
0x20910081
278+
0x20910082
265279
0x20910083
266280
0x20910084
267281
0x20910085
@@ -347,6 +361,11 @@
347361
0x209100e4
348362
0x209100e5
349363
0x209100e6
364+
0x209100e7
365+
0x209100e8
366+
0x209100e9
367+
0x209100ea
368+
0x209100eb
350369
0x209100ec
351370
0x209100ed
352371
0x209100ee
@@ -718,17 +737,25 @@
718737
0x20a30063
719738
0x20a30064
720739
0x20a70001
721-
0x20c70003
722740
0x30050001
723741
0x30060007
724742
0x3006000a
725743
0x3006000b
726744
0x30060017
727745
0x30060018
746+
0x30060020
747+
0x30060021
748+
0x30060022
728749
0x3006002e
729750
0x3006002f
730751
0x3007000a
731752
0x3007000e
753+
0x30070012
754+
0x30070013
755+
0x30070014
756+
0x30080002
757+
0x30080003
758+
0x30080004
732759
0x30090008
733760
0x30110017
734761
0x301100b1
@@ -738,13 +765,16 @@
738765
0x301100b5
739766
0x30210001
740767
0x30210002
768+
0x30250016
741769
0x3025003b
770+
0x30360008
742771
0x30370008
743772
0x3065000a
744773
0x3065000b
745774
0x3065000c
746775
0x30930033
747776
0x30a20004
777+
0x30a3003c
748778
0x30f6000a
749779
0x30f6000b
750780
0x40050002
@@ -798,7 +828,3 @@
798828
0x50650016
799829
0x50650017
800830
0x50650018
801-
0x50c70004
802-
0x50c70005
803-
0x50c70006
804-
0x50c70007

keys/u-blox_config_keys_sorted.txt

+11
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
0x20060016
194194
0x2006001e
195195
0x2006001f
196+
0x20060030
196197
0x2007000b
197198
0x20090009
198199
0x20110011
@@ -954,10 +955,19 @@
954955
0x3006000b
955956
0x30060017
956957
0x30060018
958+
0x30060020
959+
0x30060021
960+
0x30060022
957961
0x3006002e
958962
0x3006002f
959963
0x3007000a
960964
0x3007000e
965+
0x30070012
966+
0x30070013
967+
0x30070014
968+
0x30080002
969+
0x30080003
970+
0x30080004
961971
0x30090001
962972
0x30090008
963973
0x30110017
@@ -970,6 +980,7 @@
970980
0x30210001
971981
0x30210002
972982
0x30230002
983+
0x30250016
973984
0x3025003b
974985
0x30360008
975986
0x30370008

keywords.txt

+8
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,14 @@ assumeAutoHNRPVT KEYWORD2
620620
flushHNRPVT KEYWORD2
621621
logHNRPVT KEYWORD2
622622

623+
getSECSIG KEYWORD2
624+
setAutoSECSIG KEYWORD2
625+
setAutoSECSIGrate KEYWORD2
626+
setAutoSECSIGcallbackPtr KEYWORD2
627+
assumeAutoSECSIG KEYWORD2
628+
flushSECSIG KEYWORD2
629+
logSECSIG KEYWORD2
630+
623631
setNavigationFrequency KEYWORD2
624632
getNavigationFrequency KEYWORD2
625633
setMeasurementRate KEYWORD2

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SparkFun u-blox GNSS v3
2-
version=3.1.8
2+
version=3.1.9
33
author=SparkFun Electronics <[email protected]>
44
maintainer=SparkFun Electronics <sparkfun.com>
55
sentence=Library for I2C, Serial and SPI Communication with u-blox GNSS modules<br/><br/>

src/u-blox_Class_and_ID.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ const uint8_t UBX_RXM_SPARTNKEY = 0x36; // Poll/transfer dynamic SPARTN keys
290290

291291
// Class: SEC
292292
// The following are used to configure the SEC UBX messages (security feature messages). Descriptions from UBX messages overview (ZED_F9P Interface Description Document page 36)
293+
const uint8_t UBX_SEC_SIG = 0x09; // Signal security information
293294
const uint8_t UBX_SEC_UNIQID = 0x03; // Unique chip ID
294295

295296
// Class: TIM
@@ -402,10 +403,11 @@ enum dynModel // Possible values for the dynamic platform model, which provide m
402403
DYN_MODEL_AIRBORNE1g, // Airborne <1g acceleration. Used for applications with a higher dynamic range and greater vertical acceleration than a passenger car. No 2D position fixes supported.
403404
DYN_MODEL_AIRBORNE2g, // Airborne <2g acceleration. Recommended for typical airborne environments. No 2D position fixes supported.
404405
DYN_MODEL_AIRBORNE4g, // Airborne <4g acceleration. Only recommended for extremely dynamic environments. No 2D position fixes supported.
405-
DYN_MODEL_WRIST, // Not supported in protocol versions less than 18. Only recommended for wrist worn applications. Receiver will filter out arm motion.
406-
DYN_MODEL_BIKE, // Supported in protocol versions 19.2. (not available in all products)
407-
DYN_MODEL_MOWER, // Added in HPS 1.21 (not available in all products)
408-
DYN_MODEL_ESCOOTER, // Added in HPS 1.21 (not available in all products)
406+
DYN_MODEL_WRIST, // Wrist-worn watch. Not supported in protocol versions less than 18. Only recommended for wrist worn applications. Receiver will filter out arm motion.
407+
DYN_MODEL_BIKE, // Motorbike. Supported in protocol versions 19.2. (not available in all products)
408+
DYN_MODEL_MOWER, // Robotic lawn mower. Added in HPS 1.21 (not available in all products)
409+
DYN_MODEL_ESCOOTER, // E-scooter. Added in HPS 1.21 (not available in all products)
410+
DYN_MODEL_RAIL, // Rail vehicles (trains, trams). Added in HPS 1.40 (not available in all products)
409411
DYN_MODEL_UNKNOWN = 255 // getDynamicModel will return 255 if sendCommand fails
410412
};
411413

0 commit comments

Comments
 (0)