There are two types of checksum calculations which can be selected in the Bootloader component configuration (Basic Summation and CRC-16-CCITT).
Based on this the checksum option in the .cyacd header changes. Can you check if you are calculation the checksum with respect to this configuration?
I checked just to make sure but the option that is selected is the basic summation, which is what I prepared my packets for. I'm fairly certain that summation uses two's complement where the LSB is sent first and the MSB is sent second. The issue might be in my LSB and MSB but i'm almost certain that what is being sent are the correct values. Below is the construction of the first packet in Visual Studio along with the error packet, hope this sheds some more light on the issue.
byte packet = new byte;
packet = 0x01; // start
packet = 0x38; // command code
packet = 0x00; // Length LSB
packet = 0x00; // Length MSB
packet = 0x0C; // Checksum LSB
packet = 0x07; // Checksum MSB
packet = 0x17; // End
1 8 0 0 247 255 23
Actually the checksum calculated for the packet is wrong as per basic summation. The checksum should be c7 ff.
Checksum = (0x01+(0xFFFF- (0x01+0x38)))= FF C7
can you try this?
This works! Just so I don't have any questions in the future, how would I calculate the checksum for a packet with multiple bytes?
It should be similar to the method mentioned above. Add all the 8 bytes. Subtract from 0xFFFF and add 0x01.