Skip to content

Commit a186664

Browse files
committed
Add UBX-RXM-COR to ZED examples 19 and 20
1 parent 05854eb commit a186664

File tree

2 files changed

+134
-4
lines changed

2 files changed

+134
-4
lines changed

examples/ZED-F9P/Example19_LBand_Corrections_with_NEO-D9S/Example19_LBand_Corrections_with_NEO-D9S.ino

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,67 @@ void printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct)
121121

122122
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
123123

124+
// Callback: printRXMCOR will be called when new RXM COR data arrives
125+
// See u-blox_structs.h for the full definition of UBX_RXM_COR_data_t
126+
// _____ You can use any name you like for the callback. Use the same name when you call setRXMCORcallbackPtr
127+
// / _____ This _must_ be UBX_RXM_COR_data_t
128+
// | / _____ You can use any name you like for the struct
129+
// | | /
130+
// | | |
131+
void printRXMCOR(UBX_RXM_COR_data_t *ubxDataStruct)
132+
{
133+
Serial.print(F("UBX-RXM-COR: ebno: "));
134+
Serial.print(ubxDataStruct->ebno);
135+
136+
Serial.print(F(" protocol: "));
137+
if (ubxDataStruct->statusInfo.bits.protocol == 1)
138+
Serial.print(F("RTCM3"));
139+
else if (ubxDataStruct->statusInfo.bits.protocol == 2)
140+
Serial.print(F("SPARTN"));
141+
else if (ubxDataStruct->statusInfo.bits.protocol == 29)
142+
Serial.print(F("PMP (SPARTN)"));
143+
else if (ubxDataStruct->statusInfo.bits.protocol == 30)
144+
Serial.print(F("QZSSL6"));
145+
else
146+
Serial.print(F("Unknown"));
147+
148+
Serial.print(F(" errStatus: "));
149+
if (ubxDataStruct->statusInfo.bits.errStatus == 1)
150+
Serial.print(F("Error-free"));
151+
else if (ubxDataStruct->statusInfo.bits.errStatus == 2)
152+
Serial.print(F("Erroneous"));
153+
else
154+
Serial.print(F("Unknown"));
155+
156+
Serial.print(F(" msgUsed: "));
157+
if (ubxDataStruct->statusInfo.bits.msgUsed == 1)
158+
Serial.print(F("Not used"));
159+
else if (ubxDataStruct->statusInfo.bits.msgUsed == 2)
160+
Serial.print(F("Used"));
161+
else
162+
Serial.print(F("Unknown"));
163+
164+
Serial.print(F(" msgEncrypted: "));
165+
if (ubxDataStruct->statusInfo.bits.msgEncrypted == 1)
166+
Serial.print(F("Not encrypted"));
167+
else if (ubxDataStruct->statusInfo.bits.msgEncrypted == 2)
168+
Serial.print(F("Encrypted"));
169+
else
170+
Serial.print(F("Unknown"));
171+
172+
Serial.print(F(" msgDecrypted: "));
173+
if (ubxDataStruct->statusInfo.bits.msgDecrypted == 1)
174+
Serial.print(F("Not decrypted"));
175+
else if (ubxDataStruct->statusInfo.bits.msgDecrypted == 2)
176+
Serial.print(F("Successfully decrypted"));
177+
else
178+
Serial.print(F("Unknown"));
179+
180+
Serial.println();
181+
}
182+
183+
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
184+
124185
void setup()
125186
{
126187
Serial.begin(115200);
@@ -148,6 +209,8 @@ void setup()
148209
if (ok) ok = myGNSS.setNavigationFrequency(1); //Set output in Hz.
149210

150211
if (ok) ok = myGNSS.setVal8(UBLOX_CFG_SPARTN_USE_SOURCE, 1); // use LBAND PMP message
212+
213+
if (ok) ok = myGNSS.setVal8(UBLOX_CFG_MSGOUT_UBX_RXM_COR_I2C, 1); // Enable UBX-RXM-COR messages on I2C
151214

152215
//Configure the SPARTN IP Dynamic Keys
153216
//"When the receiver boots, the host should send 'current' and 'next' keys in one message." - Use setDynamicSPARTNKeys for this.
@@ -164,6 +227,8 @@ void setup()
164227

165228
myGNSS.setAutoPVTcallbackPtr(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata so we can watch the carrier solution go to fixed
166229

230+
myGNSS.setRXMCORcallbackPtr(&printRXMCOR); // Print the contents of UBX-RXM-COR messages so we can check if the PMP data is being decrypted successfully
231+
167232
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
168233
// Begin and configure the NEO-D9S L-Band receiver
169234

examples/ZED-F9P/Example20_PMP_with_L-Band_Keys_via_MQTT/Example20_PMP_with_L-Band_Keys_via_MQTT.ino

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ const uint32_t myLBandFreq = 1556290000; // Uncomment this line to use the US SP
5858

5959
#define OK(ok) (ok ? F(" -> OK") : F(" -> ERROR!")) // Convert uint8_t into OK/ERROR
6060

61+
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
62+
63+
//Global variables
64+
65+
long lastReceived_ms = 0; //5 RTCM messages take approximately ~300ms to arrive at 115200bps
66+
int maxTimeBeforeHangup_ms = 10000; //If we fail to get a complete RTCM frame after 10s, then disconnect from caster
67+
6168
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6269

6370
// Callback: pushRXMPMP will be called when new PMP data arrives
@@ -143,11 +150,65 @@ void printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct)
143150
}
144151

145152
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
146-
147-
//Global variables
148153

149-
long lastReceived_ms = 0; //5 RTCM messages take approximately ~300ms to arrive at 115200bps
150-
int maxTimeBeforeHangup_ms = 10000; //If we fail to get a complete RTCM frame after 10s, then disconnect from caster
154+
// Callback: printRXMCOR will be called when new RXM COR data arrives
155+
// See u-blox_structs.h for the full definition of UBX_RXM_COR_data_t
156+
// _____ You can use any name you like for the callback. Use the same name when you call setRXMCORcallbackPtr
157+
// / _____ This _must_ be UBX_RXM_COR_data_t
158+
// | / _____ You can use any name you like for the struct
159+
// | | /
160+
// | | |
161+
void printRXMCOR(UBX_RXM_COR_data_t *ubxDataStruct)
162+
{
163+
Serial.print(F("UBX-RXM-COR: ebno: "));
164+
Serial.print(ubxDataStruct->ebno);
165+
166+
Serial.print(F(" protocol: "));
167+
if (ubxDataStruct->statusInfo.bits.protocol == 1)
168+
Serial.print(F("RTCM3"));
169+
else if (ubxDataStruct->statusInfo.bits.protocol == 2)
170+
Serial.print(F("SPARTN"));
171+
else if (ubxDataStruct->statusInfo.bits.protocol == 29)
172+
Serial.print(F("PMP (SPARTN)"));
173+
else if (ubxDataStruct->statusInfo.bits.protocol == 30)
174+
Serial.print(F("QZSSL6"));
175+
else
176+
Serial.print(F("Unknown"));
177+
178+
Serial.print(F(" errStatus: "));
179+
if (ubxDataStruct->statusInfo.bits.errStatus == 1)
180+
Serial.print(F("Error-free"));
181+
else if (ubxDataStruct->statusInfo.bits.errStatus == 2)
182+
Serial.print(F("Erroneous"));
183+
else
184+
Serial.print(F("Unknown"));
185+
186+
Serial.print(F(" msgUsed: "));
187+
if (ubxDataStruct->statusInfo.bits.msgUsed == 1)
188+
Serial.print(F("Not used"));
189+
else if (ubxDataStruct->statusInfo.bits.msgUsed == 2)
190+
Serial.print(F("Used"));
191+
else
192+
Serial.print(F("Unknown"));
193+
194+
Serial.print(F(" msgEncrypted: "));
195+
if (ubxDataStruct->statusInfo.bits.msgEncrypted == 1)
196+
Serial.print(F("Not encrypted"));
197+
else if (ubxDataStruct->statusInfo.bits.msgEncrypted == 2)
198+
Serial.print(F("Encrypted"));
199+
else
200+
Serial.print(F("Unknown"));
201+
202+
Serial.print(F(" msgDecrypted: "));
203+
if (ubxDataStruct->statusInfo.bits.msgDecrypted == 1)
204+
Serial.print(F("Not decrypted"));
205+
else if (ubxDataStruct->statusInfo.bits.msgDecrypted == 2)
206+
Serial.print(F("Successfully decrypted"));
207+
else
208+
Serial.print(F("Unknown"));
209+
210+
Serial.println();
211+
}
151212

152213
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
153214

@@ -180,13 +241,17 @@ void setup()
180241

181242
if (ok) ok = myGNSS.setVal8(UBLOX_CFG_SPARTN_USE_SOURCE, 1); // use LBAND PMP message
182243

244+
if (ok) ok = myGNSS.setVal8(UBLOX_CFG_MSGOUT_UBX_RXM_COR_I2C, 1); // Enable UBX-RXM-COR messages on I2C
245+
183246
//if (ok) ok = myGNSS.saveConfiguration(VAL_CFG_SUBSEC_IOPORT | VAL_CFG_SUBSEC_MSGCONF); //Optional: Save the ioPort and message settings to NVM
184247

185248
Serial.print(F("GNSS: configuration "));
186249
Serial.println(OK(ok));
187250

188251
myGNSS.setAutoPVTcallbackPtr(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata so we can watch the carrier solution go to fixed
189252

253+
myGNSS.setRXMCORcallbackPtr(&printRXMCOR); // Print the contents of UBX-RXM-COR messages so we can check if the PMP data is being decrypted successfully
254+
190255
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
191256
// Begin and configure the NEO-D9S L-Band receiver
192257

0 commit comments

Comments
 (0)