cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

I'm having an issue with the checksum not working for the first packet in making a custom UART,per the Psoc 3, Psoc 4, Psoc 5LP and Psoc Analog Coprocessor UART Bootloader page 33-35 http://www.cypress.com/file/45171/download . This packet only contains start, the enter bootload command,the checksum for those two commands and the end command.The checksum should be the two's complement of the LSB and MSB for the addition of 0x38 and 0x01 which is 0x39 but for some reason the psoc is responding with incorrect checksum or 0x08. The current values that I am using are 0x07 for the LSB and 0x0C for the MSB. If  anyone has an idea on what the issue may be please reply.

-Thanks

0 Likes
Reply
1 Solution
Employee

Hello ,

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?

Thanks,

Hima

View solution in original post

0 Likes
Reply
5 Replies
Employee

Hello,

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?

Thanks,

Hima

0 Likes
Reply
Anonymous
Not applicable

Hi Hima,

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[7];

packet[0] = 0x01; // start

packet[1] = 0x38; // command code

packet[2] = 0x00; // Length LSB

packet[3] = 0x00; // Length MSB

packet[4] = 0x0C; // Checksum LSB

packet[5] = 0x07; // Checksum MSB

packet[6] = 0x17; // End

Response packet

1  8   0    0    247   255     23

-Thanks

  Adam

0 Likes
Reply
Employee

Hello ,

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?

Thanks,

Hima

View solution in original post

0 Likes
Reply
Anonymous
Not applicable

Hi Hima,

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?

-Thanks

  Adam

0 Likes
Reply
Employee

It should be similar to the method mentioned above. Add all the 8 bytes. Subtract from 0xFFFF and add 0x01.

Thanks,

Hima

0 Likes
Reply