April 22, 201610 yr Hi All, sorry, but there is no software topic yet, so need to post under general... This is a query to the software developers amongst us. Further to my issues with my Axpert (serial comms speed), I have come across an annoying checksum problem (and maybe why my unit refuses to work with the generic software out there): I have checked and double checked results, but this is definately an issue. More importantly, I would like to know if others are experiencing... The software checksum results for Axpert on a simple QPIGS command, only returns a valid checksum about 1/10 responses. I have triple/quadruple checked my checksum calculation and it is definately correct, even taking into account the Axpert oddity. At first I really though that this was my own unit, but with a friends help, I swapped Invertors completely with another unit (everything, including the Comms) - That unit was purchased in the same week as mine. I am getting the same results, bad checksums from the Axpert. Both systems report the later firmware (although they could have been flashed with the same faulty code)... Just wondering if I am unique in this situation, or if this is something I need to take into account with the software (currently a valid poll can take nearly 4 minutes) I recently got a Victron BMV702, which I am adding to my devices, but I think I am missing the point on how their checksum works. I have the basic document from the Victron page, but I may be missing the idea. Would love to hear someone else's thoughts/experiences with the communication protocol (I am already annoyed that I have to drop read packets all the time thanks to the "VE.Direct Text" - Is there any way to turn that off?). Thanks in advance for responses, and apologies if posted in the wrong place, I did try look for a better place to put this query.
April 22, 201610 yr BMV does not use any checksum. You open the port and read the data. Dude there is something wrong on your end if nothing works. Our software works everywhere else.
April 23, 201610 yr Author Hi JDP, not blaming anyones software - This is definately a comms issue at the invertor end. Do you read the checksum result in your software to validate the data? To remote change settings on the BMV, you do need the checksum. Also to query a specific setting. Also the open port reading supplies a checksum with it's result (last characters), which I want to check to validate comms. BMV-70x-HEX-Protocol-public.pdf
April 23, 201610 yr Why do you want to set the values on the BMV. It is maybe 3 values you can set. And once you set them you never set them again. I do not use the HEX protocol.
April 23, 201610 yr 2 hours ago, jdp said: Why do you want to set the values on the BMV. It is maybe 3 values you can set. And once you set them you never set them again. I do not use the HEX protocol. Manual control of the relay is one
April 24, 201610 yr Author It's more of a case of me wanting to confirm values are accurate, especially over the 40m cable run, and the bad experiences with other comms (other devices). But as above, if I want to change a setting remotely, or check a specific setting, then the checksum has to be valid. I have gotten close with some commands (checksum of 0x055 by the simple rotation method and ignoring the first colon sent/received), but I cant seem to get there with the generic text received on the port every second, and a few commands/responses don't seem to comply (PS: this is a different machine to the Axpert glitches in another thread) would be nice to validate that.
April 24, 201610 yr Here is the HEX and Direct Protocol. BMV-70x HEX Protocol - public.pdf VE.Direct Protocol.docx
April 26, 20179 yr checksum is used to validate data, if checksum doesn't match the data communicated has an error. Victron Hex Protocol is an ASCII representation of Hex. The checksum is calculated by subtraction. Define the checksum as "byte" which has the effect of discarding any overflow. Here it is for C used by Arduino. ASCII characters are converted to byte and subtracted from checksum. boolean victronCheckSum(char* testString, int testStringLength) { // first character is : so start with 85 and subtract second character byte checkSum = 85; checkSum = checkSum - x2i(&testString[1], 1); // subtract pairs of characters for (int i=2; i<testStringLength; i+=2) { checkSum = checkSum - x2i(&testString[i], 2); } return !checkSum; // if checksum == 0 then false else true } boolean victronCheckSumCalculate(char* testString, int testStringLength) { byte checkSum = 85; checkSum = checkSum - x2i(&testString[1], 1); for (int i=2; i<testStringLength - 2; i+=2) { checkSum = checkSum - x2i(&testString[i], 2); } testString[testStringLength-1] = hexChars[checkSum >> 4]; testString[testStringLength] = hexChars[checkSum & 15]; return true; } // borrowed from http://forum.arduino.cc/index.php?topic=123486.0 // converts ascii hex to integer // use instead of strtoul so can refer to chars in a char array // modified to limit length of "substring" of char array byte x2i(char *s, byte numChars) { byte x = 0; for(byte i=0; i<numChars; i++) { char c = *s; if (c >= '0' && c <= '9') { x *= 16; x += c - '0'; } else if (c >= 'A' && c <= 'F') { x *= 16; x += (c - 'A') + 10; } else if (c >= 'a' && c <= 'f') { x *= 16; x += (c - 'a') + 10; } else break; s++; } return x; }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.