Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 24-09-2015, 10:18   #1
Registered User

Join Date: Sep 2015
Posts: 5
Control Checksum doesn't seem to be operational

Hi, I am sending NMEA strings with uncalculated checksums to OpenCPN and they are accepted regardless of the "Control Checksum" setting in open CPN.

It seems to me the "control checksum" is not operational as OpenCPN should normally filter out those packets.

Does that make sense?

My setup is:
Davis anemometer connected to an arduino that generates the nmea strings, then connected to a win laptop through a USB based virtual serial port.

Here are two example strings with bad CRCs that are successfully reflected on the Open CPN dashboard:

$ARMWD,333.28,T,,,5.33,N,,,*0B
$ARMWV,333.28,R,5.33,N,A,*0B

Any comments appreciated.
__________________

__________________
simonmtl is offline   Reply With Quote
Old 26-09-2015, 12:52   #2
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 1,967
Re: Control Checksum doesn't seem to be operational

simonmtl...
I'm not a coder but if understand it correct sentences beginning with "A" are "known bad" and are treated as if the "control checksum" was not checked.

Here is an example how I produce the checksum in my Arduino, if you like:
Code:
//Create NMEA string like: $HCHDM,238.5,M*hh/CR/LF
String NMEA_HDM(String Mag) {
  String nmea = "$HCHDM,";
  nmea += Mag,DEC;
  nmea += ',';
  nmea += 'M';
  nmea += '*';
  nmea += String(testsum(nmea),HEX);
  nmea += '\r';
  nmea += '\n';
  return nmea;
}

// Calculates the Checksum for the NMEA string
int testsum(String strN) {
int i;
int XOR;
int c;
// Calculate testsum ignoring any $'s in the string
for (XOR = 0, i = 0; i < 80; i++) {  //strlen(strN)
  c = (unsigned char)strN[i];
  if (c == '*') break;
  if (c != '$') XOR ^= c;
  }
return XOR;
}
Thanks to checksum method author: http://timzaman.wordpress.com/code-c...cksum-xor-cpp/
Håkan
__________________

__________________
Hakan is offline   Reply With Quote
Old 29-09-2015, 15:58   #3
Registered User

Join Date: Sep 2015
Posts: 5
Re: Control Checksum doesn't seem to be operational

Thanks Hakan, but looks like OpenCPN doesn't care at all about the checksum for any wind related data. I tried changing the name to no avail. I have also implemented a CRC method in the arduino but I'm not using it at the moment since OpenCPN doesn't check it.

That's too bad because I occasionnally send truncated strings that corrupt the wind history graph. For instance, when wind = 300 kts is erroneously interpreted, the wind history graph becomes a flat bar with a huge spike.

Regards. Simon
__________________
simonmtl is offline   Reply With Quote
Old 29-09-2015, 21:43   #4
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 4,883
Re: Control Checksum doesn't seem to be operational

simonmtl...

Hmmm. It seems that the core OCPN code checks checksums on messages he cares about. But messages are sent in the raw to the PlugIns, without checking. It then is up to the individual PlugIn to decide what to do.

This seems not great, actually. We probably should not send bad messages to the PlugIns, just on general principles.

I will correct this for the next Beta. Frankly, I expect some breakage from the installed user base, until we learn to switch off the checksum checker for badly constructed NMEA sources. We shall see.

Any comments on this proposed new policy?

Thanks
Dave
__________________
bdbcat is online now   Reply With Quote
Old 30-09-2015, 18:49   #5
Registered User

Join Date: Sep 2015
Posts: 5
Re: Control Checksum doesn't seem to be operational

Thanks BDcat, I fully agree with you. For those who were using bad checksums, they'll be able to "fix" their issue by deactivating the "verify checksum" option.

The help files already suggest that all checksums are verified.
__________________
simonmtl is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why Do Marinas Seem to Hate Liveaboards? sneuman Liveaboard's Forum 211 Yesterday 20:17
Do skippers really want crew? Doesn't seem so... messias Training, Licensing & Certification 51 24-03-2015 00:16
For Sale: Ocean Sailing Yacht - Kaufman 49ft - 1988 - fully operational boat - REDUCED PRICE Dermot_K Classifieds Archive 2 22-10-2013 08:43



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 22:43.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.