|
| 1 | +/* |
| 2 | + NEO-D9S L-Band receiver example |
| 3 | + By: SparkFun Electronics / Paul Clark |
| 4 | + Date: March 7th, 2022 |
| 5 | + License: MIT. See license file for more information but you can |
| 6 | + basically do whatever you want with this code. |
| 7 | +
|
| 8 | + This example shows how to display the NEO-D9S's received signal imbalance and magnitude, plus a summary of any received PMP data. |
| 9 | +
|
| 10 | + Feel like supporting open source hardware? |
| 11 | + Buy a board from SparkFun! |
| 12 | + ZED-F9P RTK2: https://www.sparkfun.com/products/16481 |
| 13 | + NEO-D9S: Coming soon! |
| 14 | +
|
| 15 | + Hardware Connections: |
| 16 | + Use a Qwiic cable to connect the NEO-D9S L-Band corection data receiver to your board |
| 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 <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS |
| 22 | +SFE_UBLOX_GNSS myLBand; // NEO-D9S |
| 23 | + |
| 24 | +//const uint32_t myLBandFreq = 1556290000; // Uncomment this line to use the US SPARTN 1.8 service |
| 25 | +const uint32_t myLBandFreq = 1545260000; // Uncomment this line to use the EU SPARTN 1.8 service |
| 26 | + |
| 27 | +#define OK(ok) (ok ? F(" -> OK") : F(" -> ERROR!")) // Convert uint8_t into OK/ERROR |
| 28 | + |
| 29 | +//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= |
| 30 | + |
| 31 | +// Callback: printRXMPMP will be called when new PMP data arrives |
| 32 | +// See u-blox_structs.h for the full definition of UBX_RXM_PMP_data_t |
| 33 | +// _____ You can use any name you like for the callback. Use the same name when you call setRXMPMPcallbackPtr |
| 34 | +// / _____ This _must_ be UBX_RXM_PMP_data_t |
| 35 | +// | / _____ You can use any name you like for the struct |
| 36 | +// | | / |
| 37 | +// | | | |
| 38 | +void printRXMPMP(UBX_RXM_PMP_data_t *pmpData) |
| 39 | +{ |
| 40 | + Serial.println(F("New PMP data received:")); |
| 41 | + |
| 42 | + Serial.print(F("PMP message version: ")); |
| 43 | + Serial.println(pmpData->version); |
| 44 | + |
| 45 | + Serial.print(F("numBytesUserData : ")); |
| 46 | + Serial.println(pmpData->numBytesUserData); |
| 47 | + |
| 48 | + Serial.print(F("serviceIdentifier: ")); |
| 49 | + Serial.println(pmpData->serviceIdentifier); |
| 50 | + |
| 51 | + Serial.print(F("uniqueWordBitErrors: ")); |
| 52 | + Serial.println(pmpData->uniqueWordBitErrors); |
| 53 | + |
| 54 | + Serial.print(F("fecBits: ")); |
| 55 | + Serial.println(pmpData->fecBits); |
| 56 | + |
| 57 | + Serial.print(F("ebno: ")); |
| 58 | + Serial.println(pmpData->ebno); |
| 59 | + |
| 60 | + Serial.println(); |
| 61 | +} |
| 62 | + |
| 63 | +//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= |
| 64 | + |
| 65 | +void setup() |
| 66 | +{ |
| 67 | + Serial.begin(115200); |
| 68 | + Serial.println(F("NEO-D9S Example")); |
| 69 | + |
| 70 | + Wire.begin(); //Start I2C |
| 71 | + |
| 72 | + //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= |
| 73 | + // Begin and configure the NEO-D9S L-Band receiver |
| 74 | + |
| 75 | + //myLBand.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial |
| 76 | + |
| 77 | + while (myLBand.begin(Wire, 0x43) == false) //Connect to the u-blox NEO-D9S using Wire port. The D9S default I2C address is 0x43 (not 0x42) |
| 78 | + { |
| 79 | + Serial.println(F("u-blox NEO-D9S not detected at default I2C address. Please check wiring.")); |
| 80 | + delay(2000); |
| 81 | + } |
| 82 | + Serial.println(F("u-blox NEO-D9S connected")); |
| 83 | + |
| 84 | + uint8_t ok = myLBand.setVal32(UBLOX_CFG_PMP_CENTER_FREQUENCY, myLBandFreq); // Default 1539812500 Hz |
| 85 | + if (ok) ok = myLBand.setVal16(UBLOX_CFG_PMP_SEARCH_WINDOW, 2200); // Default 2200 Hz |
| 86 | + if (ok) ok = myLBand.setVal8(UBLOX_CFG_PMP_USE_SERVICE_ID, 0); // Default 1 |
| 87 | + if (ok) ok = myLBand.setVal16(UBLOX_CFG_PMP_SERVICE_ID, 21845); // Default 50821 |
| 88 | + if (ok) ok = myLBand.setVal16(UBLOX_CFG_PMP_DATA_RATE, 2400); // Default 2400 bps |
| 89 | + if (ok) ok = myLBand.setVal8(UBLOX_CFG_PMP_USE_DESCRAMBLER, 1); // Default 1 |
| 90 | + if (ok) ok = myLBand.setVal16(UBLOX_CFG_PMP_DESCRAMBLER_INIT, 26969); // Default 23560 |
| 91 | + if (ok) ok = myLBand.setVal8(UBLOX_CFG_PMP_USE_PRESCRAMBLING, 0); // Default 0 |
| 92 | + if (ok) ok = myLBand.setVal64(UBLOX_CFG_PMP_UNIQUE_WORD, 16238547128276412563ull); |
| 93 | + if (ok) ok = myLBand.setVal(UBLOX_CFG_MSGOUT_UBX_RXM_PMP_I2C, 1); // Ensure UBX-RXM-PMP is enabled on the I2C port |
| 94 | + if (ok) ok = myLBand.setVal(UBLOX_CFG_MSGOUT_UBX_RXM_PMP_UART1, 1); // Output UBX-RXM-PMP on UART1 |
| 95 | + if (ok) ok = myLBand.setVal(UBLOX_CFG_MSGOUT_UBX_RXM_PMP_UART2, 1); // Output UBX-RXM-PMP on UART2 |
| 96 | + if (ok) ok = myLBand.setVal32(UBLOX_CFG_UART1_BAUDRATE, 38400); // match baudrate with ZED default |
| 97 | + if (ok) ok = myLBand.setVal32(UBLOX_CFG_UART2_BAUDRATE, 38400); // match baudrate with ZED default |
| 98 | + |
| 99 | + Serial.print(F("L-Band: configuration ")); |
| 100 | + Serial.println(OK(ok)); |
| 101 | + |
| 102 | + myLBand.softwareResetGNSSOnly(); // Do a restart |
| 103 | + |
| 104 | + myLBand.setRXMPMPcallbackPtr(&printRXMPMP); // Call printRXMPMP when new PMP data arrives |
| 105 | +} |
| 106 | + |
| 107 | +//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= |
| 108 | + |
| 109 | +void loop() |
| 110 | +{ |
| 111 | + myLBand.checkUblox(); // Check for the arrival of new PMP data and process it. |
| 112 | + myLBand.checkCallbacks(); // Check if any LBand callbacks are waiting to be processed. |
| 113 | + |
| 114 | + UBX_MON_HW2_data_t hwStatus; // Create storage for the HW2 extended hardware status |
| 115 | + if (myLBand.getHW2status(&hwStatus)) // Request the extended hardware status |
| 116 | + { |
| 117 | + // Print the signal imbalance and magnitude |
| 118 | + Serial.print(F("Signal imbalance and magnitude: ofsI: ")); |
| 119 | + Serial.print(hwStatus.ofsI); |
| 120 | + Serial.print(F(" magI: ")); |
| 121 | + Serial.print(hwStatus.magI); |
| 122 | + Serial.print(F(" ofsQ: ")); |
| 123 | + Serial.print(hwStatus.ofsQ); |
| 124 | + Serial.print(F(" magQ: ")); |
| 125 | + Serial.println(hwStatus.magQ); |
| 126 | + } |
| 127 | +} |
0 commit comments