I want to disable the $GPGSV sentences on u-Blox NEO-7M because I have serial buffer overflow on Arduino. I found in the Receiver Discription p.69 and tried sending this:
$PUBX,40,GSV,0,0,0,0,0,0*59
But the receiver keeps sending the $GPGSV.
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityI want to disable the $GPGSV sentences on u-Blox NEO-7M because I have serial buffer overflow on Arduino. I found in the Receiver Discription p.69 and tried sending this:
$PUBX,40,GSV,0,0,0,0,0,0*59
But the receiver keeps sending the $GPGSV.
Without knowing much about how you're dealing with the incoming data, but if it's overflowing then its probably because the previous/current data is or has not been dealt with in a timely fashion.
With ublox7's; NEMA sentences are enabled via:
$PUBX,40,msgType,0,1,0,0*checksum
and disabled via:
$PUBX,40,msgType,0,0,0,0*checksum
You have 6 variables after the msgType whereas only 4 are expected. Other modules may require 6.
Checksum is calculated by XOR'ing all characters between the $ and the *, and is a 2 char HEX value.
eg;
// test string
const char *msg = "PUBX,40,GSV,0,0,0,0";
// find checksum
int checksum = 0;
for (int i = 0; msg[i]; i++)
checksum ^= (unsigned char)msg[i];
// convert and create checksum HEX string
char checkTmp[8];
snprintf(checkTmp, sizeof(checkTmp)-1, F("*%.2X"), checksum);
// send to module
module.print("$");
module.print(msg);
module.println(checkTmp);
and to put this in to something [re]usable:
inline int calculateChecksum (const char *msg)
{
int checksum = 0;
for (int i = 0; msg[i] && i < 32; i++)
checksum ^= (unsigned char)msg[i];
return checksum;
}
INLINE int nemaMsgSend (const char *msg)
{
char checksum[8];
snprintf(checksum, sizeof(checksum)-1, F("*%.2X"), calculateChecksum(msg));
module.print("$");
module.print(msg);
module.println(checksum);
}
inline int nemaMsgDisable (const char *nema)
{
if (strlen(nema) != 3) return 0;
char tmp[32];
snprintf(tmp, sizeof(tmp)-1, F("PUBX,40,%s,0,0,0,0"), nema);
//snprintf(tmp, sizeof(tmp)-1, F("PUBX,40,%s,0,0,0,0,0,0"), nema);
nemaMsgSend(tmp);
return 1;
}
inline int nemaMsgEnable (const char *nema)
{
if (strlen(nema) != 3) return 0;
char tmp[32];
snprintf(tmp, sizeof(tmp)-1, F("PUBX,40,%s,0,1,0,0"), nema);
//snprintf(tmp, sizeof(tmp)-1, F("PUBX,40,%s,0,1,0,0,0,0"), nema);
nemaMsgSend(tmp);
return 1;
}
and then to disable a message:
nemaMsgDisable("GSV");
to enable a message:
nemaMsgEnable("GSV");
Hope this helps.
Michael
F("*%.2X")
with "*%.2X"
but have still no idea how that line of code works
– MatMis
Jul 22 '16 at 16:59
$PUBX,40,msgType,0,0,0,1*checksum
to re-enable a msgType (see the location of the 1
). Thanks for the great answer!
– Daniel F
Oct 11 '18 at 12:00
I found that if you use the hardware serial from arduino that you can not configure the receiver with u-center. It works with softwareSerial. If someone knows why, please let me know. :)
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
//mySerial.println("Hello, world?");
}
void loop() { // run over and over
if (mySerial.available()) {
Serial.write(mySerial.read());
}
if (Serial.available()) {
mySerial.write(Serial.read());
}
}