Hi all,
I’m trying to send a UBX_UPD_SOS command to a NEO-M9N GPS board to back up the GPS data, as my battery backup just doesn’t seem to work, even though the battery is charged. I took an example in the library which sends a rate update and have tried to modify it to send the command but it’s just not working. I’m guessing there’s something I’m missing but the UBlox Interface Description doc doesn’t spell it out all that clearly to someone who’s not 100% familiar with UBlox commands. Here’s a snippet of code which is trying to do this:
//trying to get UBX_UPD_SOS to work
//const uint8_t UBX_UPD_SOS = 0x14 as per UBlox interface description and is declared in SparkFun_u-blox_GNSS_Arduino_Library.h
//const uint8_t UBX_CLASS_UPD = 0x09 as per UBlox interface description and is declared in SparkFun_u-blox_GNSS_Arduino_Library.h
uint8_t customPayload[MAX_PAYLOAD_SIZE]; // This array holds the payload data bytes
// The next line creates and initialises the packet information which wraps around the payload
ubxPacket customCfg = {0, 0, 0, 0, 0, customPayload, 0, 0, SFE_UBLOX_PACKET_VALIDITY_NOT_DEFINED, SFE_UBLOX_PACKET_VALIDITY_NOT_DEFINED};
customCfg.cls = 0x09;//UBX_CLASS_UPD This is the message Class
customCfg.id = 0x14;//UBX_UPD_SOS This is the message ID
customCfg.len = 4; // Setting the len (length) to 4 as per UBlox interface description
customCfg.startingSpot = 0; // Always set the startingSpot to zero (unless you really know what you are doing)
// We also need to tell sendCommand how long it should wait for a reply
uint16_t maxWait = 250; // Wait for up to 250ms (Serial may need a lot longer e.g. 1100)
customPayload[0] = 0;// command = 0 as per UBlox interface description
customPayload[1] = 0;// reserved, set to 0 as per UBlox interface description
if (myGPS.sendCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
{
Serial.println(F("sendCommand failed! Freezing..."));
while (1)
;
}
It’s taken from the library example “Example20_SendCustomCommand.ino” which I was able to get to work, albeit with a bit of fiddling as I’m using an Artemis Openlog board.
Has anyone had any success in sending other custom commands? I’m not 100% sure exactly what I’m meant to be putting in the data payload, I think it’s two bytes of 0: first byte being the command, the second byte being reserved but it does indicate that a reserved byte should be given the value of 0.
Thanks!
Stu.