From eba80635633fd66a349b1b468a6a3e26a421a6f1 Mon Sep 17 00:00:00 2001 From: PaulZC Date: Fri, 4 Feb 2022 18:12:54 +0000 Subject: [PATCH] Add more support for UBX-RXM-PMP --- src/SparkFun_u-blox_GNSS_Arduino_Library.h | 12 +++++++++++- src/u-blox_structs.h | 13 ++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/SparkFun_u-blox_GNSS_Arduino_Library.h b/src/SparkFun_u-blox_GNSS_Arduino_Library.h index 71b1e1b..aa14ee5 100644 --- a/src/SparkFun_u-blox_GNSS_Arduino_Library.h +++ b/src/SparkFun_u-blox_GNSS_Arduino_Library.h @@ -375,7 +375,8 @@ const uint8_t UBX_NAV_AOPSTATUS = 0x60; //AssistNow Autonomous status //Class: RXM //The following are used to configure the RXM UBX messages (receiver manager messages). Descriptions from UBX messages overview (ZED_F9P Interface Description Document page 36) const uint8_t UBX_RXM_MEASX = 0x14; //Satellite Measurements for RRLP -const uint8_t UBX_RXM_PMREQ = 0x41; //Requests a Power Management task (two differenent packet sizes) +const uint8_t UBX_RXM_PMREQ = 0x41; //Requests a Power Management task (two different packet sizes) +const uint8_t UBX_RXM_PMP = 0x72; //PMP raw data (two different versions) (packet size for version 0x01 is variable) const uint8_t UBX_RXM_RAWX = 0x15; //Multi-GNSS Raw Measurement Data const uint8_t UBX_RXM_RLM = 0x59; //Galileo SAR Short-RLM report (two different packet sizes) const uint8_t UBX_RXM_RTCM = 0x32; //RTCM input status @@ -1070,6 +1071,13 @@ public: // Receiver Manager Messages (RXM) + // Configure a callback for the UBX-RXM-PMP messages produced by the NEO-D9S + // Note: on the NEO-D9S, the UBX-RXM-PMP messages are enabled by default on all ports. + // You can disable them by calling (e.g.) setVal8(UBLOX_CFG_MSGOUT_UBX_RXM_PMP_I2C, 0) + // The NEO-D9S does not support UBX-CFG-MSG + bool setAutoRXMPMPcallback(void (*callbackPointer)(UBX_RXM_PMP_data_t), uint16_t maxWait = defaultMaxWait); // Callback is passed all of the data. Heavy on the stack. May cause problems on some platforms. + bool setAutoRXMPMPcallbackPtr(void (*callbackPointerPtr)(UBX_RXM_PMP_data_t *), uint16_t maxWait = defaultMaxWait); // Callback receives a pointer to the data, instead of _all_ the data. Much kinder on the stack! + bool getRXMSFRBX(uint16_t maxWait = defaultMaxWait); // RXM SFRBX bool setAutoRXMSFRBX(bool enabled, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic RXM SFRBX reports at the navigation frequency bool setAutoRXMSFRBX(bool enabled, bool implicitUpdate, uint16_t maxWait = defaultMaxWait); //Enable/disable automatic RXM SFRBX reports at the navigation frequency, with implicitUpdate == false accessing stale data will not issue parsing of data in the rxbuffer of your interface, instead you have to call checkUblox when you want to perform an update @@ -1385,6 +1393,7 @@ public: UBX_NAV_RELPOSNED_t *packetUBXNAVRELPOSNED = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary UBX_NAV_AOPSTATUS_t *packetUBXNAVAOPSTATUS = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary + UBX_RXM_PMP_t *packetUBXRXMPMP = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary UBX_RXM_SFRBX_t *packetUBXRXMSFRBX = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary UBX_RXM_RAWX_t *packetUBXRXMRAWX = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary @@ -1472,6 +1481,7 @@ private: bool initPacketUBXNAVSAT(); // Allocate RAM for packetUBXNAVSAT and initialize it bool initPacketUBXNAVRELPOSNED(); // Allocate RAM for packetUBXNAVRELPOSNED and initialize it bool initPacketUBXNAVAOPSTATUS(); // Allocate RAM for packetUBXNAVAOPSTATUS and initialize it + bool initPacketUBXRXMPMP(bool usePtr = false); // Allocate RAM for packetUBXRXMPMP and initialize it bool initPacketUBXRXMSFRBX(); // Allocate RAM for packetUBXRXMSFRBX and initialize it bool initPacketUBXRXMRAWX(); // Allocate RAM for packetUBXRXMRAWX and initialize it bool initPacketUBXCFGRATE(); // Allocate RAM for packetUBXCFGRATE and initialize it diff --git a/src/u-blox_structs.h b/src/u-blox_structs.h index e7588b4..20e15a6 100644 --- a/src/u-blox_structs.h +++ b/src/u-blox_structs.h @@ -1464,21 +1464,27 @@ typedef struct } UBX_RXM_RAWX_t; // UBX-RXM-PMP (0x02 0x72): PMP raw data (D9 modules) +// There are two versions of this message but, fortunately, both have a max len of 528 const uint16_t UBX_RXM_PMP_MAX_LEN = 528; typedef struct { - uint8_t version; // Message version (0x00 for this version) - uint8_t reserved0[3]; // Reserved + uint8_t version; // Message version (0x00 / 0x01) + uint8_t reserved0; // Reserved + uint16_t numBytesUserData; // version 0x00: reserved0 ; version 0x01: Number of bytes the userData block has in this frame (0...504) uint32_t timeTag; // Time since startup when frame started : ms uint32_t uniqueWord[2]; // Received unique words uint16_t serviceIdentifier; // Received service identifier uint8_t spare; // Received spare data uint8_t uniqueWordBitErrors; // Number of bit errors in both unique words - uint8_t userData[504]; // Received user data + + // The position of fecBits, ebno and reserved1 depends on the message version uint16_t fecBits; // Number of bits corrected by FEC (forward error correction) uint8_t ebno; // Energy per bit to noise power spectral density ratio : 2^-3 dB uint8_t reserved1; // Reserved + + uint8_t userData[504]; // Received user data: version 0x00 : starts at byte 20 ; version 0x01 : starts at byte 24 + } UBX_RXM_PMP_data_t; typedef struct @@ -1487,6 +1493,7 @@ typedef struct UBX_RXM_PMP_data_t data; bool moduleQueried; void (*callbackPointer)(UBX_RXM_PMP_data_t); + void (*callbackPointerPtr)(UBX_RXM_PMP_data_t *); UBX_RXM_PMP_data_t *callbackData; } UBX_RXM_PMP_t;