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
$PUBX,40,msgType,0,0,0,1*checksum
to re-enable a msgType (see the location of the 1
). Thanks for the great answer!
The probable reason that you are having to use soft serial is that the processor you are using only has one USART which is used both for the USB port on the board and the TTL serial port if you try and use them both at the same time there is a conflict. Solution unplug your serial port cable or TTL connection. Here are some useful strings to help you with the problems some of you are having.
//U blox NMEA 6 Some command strings in Hex
//b5 62 06 01 08 00 f0 00 01 01 01 01 01 01 05 38 b5 62 06 01 02 00 f0 00 f9 11 GAA ON
//b5 62 06 01 08 00 f0 00 00 00 00 00 00 01 00 24 b5 62 06 01 02 00 f0 00 f9 11 GGA OFF
//b5 62 06 01 08 00 f0 01 01 01 01 01 01 01 06 3f b5 62 06 01 02 00 f0 01 fa 12 GLL ON
//b5 62 06 01 08 00 f0 01 00 00 00 00 00 01 01 2b b5 62 06 01 02 00 f0 01 fa 12 GLL OFF
//b5 62 06 01 08 00 f0 02 01 01 01 01 01 01 07 46 b5 62 06 01 02 00 f0 02 fb 13 GSA ON
//b5 62 06 01 08 00 f0 02 00 00 00 00 00 01 02 32 b5 62 06 01 02 00 f0 02 fb 13 GSA OFF
//b5 62 06 01 08 00 f0 03 01 01 01 01 01 01 08 4d b5 62 06 01 02 00 f0 03 fc 14 GSV ON
//b5 62 06 01 08 00 f0 03 00 00 00 00 00 01 03 39 b5 62 06 01 02 00 f0 03 fc 14 GSV OFF
//b5 62 06 01 08 00 f0 04 01 01 01 01 01 01 09 54 b5 62 06 01 02 00 f0 04 fd 15 RMC ON
//b5 62 06 01 08 00 f0 04 00 00 00 00 00 01 04 40 b5 62 06 01 02 00 f0 04 fd 15 RMC OFF
//b5 62 06 01 08 00 f0 05 01 01 01 01 01 01 0a 5b b5 62 06 01 02 00 f0 05 fe 16 VTG ON
//b5 62 06 01 08 00 f0 05 00 00 00 00 00 01 05 47 b5 62 06 01 02 00 f0 05 fe 16 VTG OFF
//Set 6 to output one message every 10 seconds
//b5 62 06 08 06 00 10 27 01 00 01 00 4d dd b5 62 06 08 00 00 0e 30
//Save 6 current configuration to Battery Backed Ram or Flash
// 62 06 09 0d 00 00 00 00 00 ff ff 00 00 00 00 00 00 03 1d ab b5 62 0a 04 00 00 0e 34
// Send strings using a serial port
void setup() {
Serial.begin(9600);
// Example to turn GGA message off
//b5 62 06 01 08 00 f0 00 00 00 00 00 00 01 00 24 b5 62 06 01 02 00 f0 00 f9 11 GGA OFF
byte message[] = {0xb5, 0x62, 0x06, 0x01, 0x08, 0x00, 0xf0, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x01, 0x00, 0x24, 0xb5, 0x62, 0x06, 0x01,0x02, 0x00, 0xf0, 0x00, 0xf9, 0x11 };
Serial.write(message, sizeof(message));
}
void loop() {
// put your main code here, to run repeatedly:
}
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());
}
}