1. When I send my image header to the cc2541 board it returns 0100 007C 42424242. What specifically is this indicating? I would assume one is CRC one is the LENGTH and one is VERSION and one is the UID. But which is which and one of them is missing right?
2. I am not sure if I produced my bin file correctly my length is 58542 does it sound about right? I did some minor changes to the SimplePeripheral Image B.
3. Am I calculating my CRC correctly?
// Compute the MODBUS RTU CRC
private static int ModRTU_CRC(byte[] buf, int len) {
int crc = 0xFFFF;
for (int pos = 0; pos < len; pos++) {
crc ^= (int)buf[pos] & 0xFF; // XOR byte into least sig. byte of crc
for (int i = 8; i != 0; i--) { // Loop over each bit
if ((crc & 0x0001) != 0) { // If the LSB is set
crc >>= 1; // Shift right and XOR 0xA001
crc ^= 0xA001;
}
else // Else LSB is not set
crc >>= 1; // Just shift right
}
}
// Note, this number has low and high bytes swapped, so use it accordingly (or swap bytes)
return crc;
}