You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I continuously receive :
*** Error : 1 sequences, and sometimes *** Error : 3.
It only parsed once a sentence in all the tests is did.
Why?
Could be due to the rate of com?
Regards.
PS I checked also the led example and gives the same error.
Connections:
Instrument sending NMEA sentences on Serial3. PC on Serial.
void setup() {
// Turn on serial monitor and set baud rate
Serial3.begin(115200); // GNSS-IMU [Serial3]
Serial.begin(115200); // PC [Serial0] | MAIN-ARDUINO [Serial1]
Serial.write("COM On");
String incomingStr = Serial3.readStringUntil('\n');//READ UNTIL NEW LINE
Serial.println(incomingStr); //PRINT
for (uint8_t i = 0; i < (incomingStr.length()); i++) {
NMEAin << incomingStr[i];
}
//NMEAin << Serial3.read(); //FORWARD INCOMING CHAR TO PARSER DIRECTLY (Alternative still not working)
}
}
The text was updated successfully, but these errors were encountered:
I discovered that the problem relies on the length of the NMEA string token PSONCMS, which is longer than 5, and the buffer size of the parser which is 77 by default.
My messages are:
"$PSONCMS,0.6847,-0.0103,0.0100,-0.7287,-0.0653,-0.2873,9.8066,0.0012,-0.0026,-0.0021,-0.2983,-0.3619,-1.2700,32.673\r\n";
"$GPGGA,004206.70,0000.0000,S,00000.0000,W,0,00,0.0,0.0,M,0.0,M55\r\n"
"$XSVEL,+000.0000,+000.0000,+000.0000*4D\r\n"
First, I tried to increase the buffer to 150 with static const uint8_t kSentenceMaxSize = 150;
This worked in parsing the sentence in which I truncated the PSONCMS with PSONC, and recalculating the checksum of the message.
But then I don't know how to bypass the problem of parsing both strings of 5 and 7 letters together. The only way I tried is to truncate the string and re-check sum before feeding it to the parser, but is atoo consuming already when reading up to 25 hz (and i would like to increase it..). Unluckily the PSONCMS is very long to be parsed and fails the tasks, reading incomplete strings of the other GPGGA and XSVEL sentences. I work with an Arduino 2560 with 115200 Baudrate
What do you suggest?
Can be the code modified easily to support longer message identifiers? Or do you suggest a way to make the code lighter?
Thank you
Hi,
I continuously receive :
*** Error : 1 sequences, and sometimes *** Error : 3.
It only parsed once a sentence in all the tests is did.
Why?
Could be due to the rate of com?
Regards.
PS I checked also the led example and gives the same error.
Connections:
Instrument sending NMEA sentences on Serial3. PC on Serial.
Type of sentences:
$PSONCMS,-0.9888,0.0072,-0.0056,-0.1491,-0.1582,-0.1052,9.8084,0.0001,-0.0016,-0.0004,0.2222,-0.1642,-1.1150,31.9*71
$GPGGA,003906.33,0000.0000,S,00000.0000,W,0,00,100.0,-17.0,M,0.0,M,,*44
$XSVEL,+000.0000,+000.0000,+000.0000*4D
CODE:
// LIBRARIES
#include <NMEAParser.h>
//INITIALISE LIBRARIES
NMEAParser<3> NMEAin; //Number of NMEA Parsers Handlers & NAME of the Parser
//INITIALISE VARIABLES
float GPS_Vx;
float GPS_Vy;
float GPS_Vz;
int incomingByte = 0; // for incoming Serial Data Bytes
char incomingChar; // for Bytes to String Data
//char incomingStr[50];
/* SETUP NMEA PARSER /
void errorHandler()
{
Serial.print("** Error : ");
Serial.println(NMEAin.error());
}
void unknownCommand()
{
Serial.print("*** Unkown command : ");
char buf[20];
NMEAin.getType(buf);
Serial.println(buf);
}
//SENTENCES HANDLERS
void PSONCMS_Handler()
{
Serial.print("Got PSONCMS with ");
Serial.print(NMEAin.argCount());
Serial.println(" arguments");
}
void GPGGA_Handler()
{
Serial.print("Got GPGGA with ");
Serial.print(NMEAin.argCount());
Serial.println(" arguments");
}
void XSVEL_Handler()
{
Serial.print("Got XSVEL with ");
Serial.print(NMEAin.argCount());
Serial.println(" arguments");
float GPS_Vx;
if (NMEAin.getArg(0,GPS_Vx)) Serial.println(GPS_Vx);
//if (NMEAin.getArg(1,GPS_Vy)) Serial.println(GPS_Vy);
//if (NMEAin.getArg(2,GPS_Vz)) Serial.println(GPS_Vz);
}
/* ----------------- */
void setup() {
// Turn on serial monitor and set baud rate
Serial3.begin(115200); // GNSS-IMU [Serial3]
Serial.begin(115200); // PC [Serial0] | MAIN-ARDUINO [Serial1]
Serial.write("COM On");
NMEAin.setErrorHandler(errorHandler);
NMEAin.addHandler("PSON-", PSONCMS_Handler);
NMEAin.addHandler("GPGGA", GPGGA_Handler);
NMEAin.addHandler("XSVEL", XSVEL_Handler);
//NMEAin.setDefaultHandler(unknownCommand);
}
void loop() {
while (Serial3.available()) {
}
}
The text was updated successfully, but these errors were encountered: