Cypress技术论坛
直播中

李瑜刈

8年用户 171经验值
私信 关注
[问答]

MSB和LSB应该用于输入Bootloader数据包吗?

我有一个问题,在定制的UART的第一个包不工作,每个PSoC 3,PSoC 4,PSoC 5LP和PSoC模拟协处理器UART Bootloader页面33-35HTTP://wwwyCysP.COM/FIL/417171下载。这个包只包含启动、输入引导加载命令、两个命令的校验和和结束命令。校验和应该是LSB和MSB的两个补充,添加0x38和0x01是0x39,但由于某种原因,PSoC响应不正确的校验和或0x。08。我使用的当前值是MSB的LSB和0x0C的0x07。如果有人对这个问题有什么想法,请回答。
-谢谢

以上来自于百度翻译


     以下为原文
  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

回帖(5)

鲁玉萍

2018-10-26 15:59:24
你好,
有两种类型的校验和计算,它们可以在引导加载程序组件配置(基本求和和CRC-16-ccITT)中选择。
在此基础上,CyAcd报头中的校验和选项发生变化。你能检查一下你是否计算这个配置的校验和?
谢谢,
希马

以上来自于百度翻译


     以下为原文
  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
举报

李瑜刈

2018-10-26 16:10:11
引用: 60user67 发表于 2018-10-26 11:58
你好,
有两种类型的校验和计算,它们可以在引导加载程序组件配置(基本求和和CRC-16-ccITT)中选择。
在此基础上,CyAcd报头中的校验和选项发生变化。你能检查一下你是否计算这个配置的校验和?

嗨,Hima,
我检查只是为了确保,但选择的选项是基本求和,这是我准备我的数据包。我相当肯定,求和使用了两个补码,其中LSB首先被发送,MSB被发送到第二个。问题可能在我的LSB和MSB中,但我几乎可以肯定,发送的是正确的值。下面是VisualStudio中的第一个包以及错误包的构建,希望这能为问题提供更多的启发。
字节[]分组=新字节[7 ];
包[ 0 ]=0x01;/ /开始
分组〔1〕=0x38;/ /命令码
分组〔2〕=0x00;/ /长度LSB
分组〔3〕=0x00;/ /长度MSB
分组〔4〕=0x0C;/ /校验和LSB
分组〔5〕=0x07;//校验和MSB
包[ 6 ]=0x17;/ /结束
响应包
1 8 0 0 0 247 255 23
-谢谢
亚当

以上来自于百度翻译


     以下为原文
  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
举报

鲁玉萍

2018-10-26 16:21:31
你好,
实际上,对于包计算的校验和是错误的,根据基本求和。校验和应该是C7 FF。
校验和=(0x01+(0xFFF-(0x01+0x38)))= FFC7
你能试试这个吗?
谢谢,
希马

以上来自于百度翻译


     以下为原文
  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
举报

李瑜刈

2018-10-26 16:39:23
引用: 60user67 发表于 2018-10-26 12:20
你好,
实际上,对于包计算的校验和是错误的,根据基本求和。校验和应该是C7 FF。
校验和=(0x01+(0xFFF-(0x01+0x38)))= FFC7

嗨,Hima,
这是有效的!所以我以后不会有任何问题,我如何计算一个具有多个字节的包的校验和?
-谢谢
亚当

以上来自于百度翻译


     以下为原文
  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
举报

更多回帖

发帖
×
20
完善资料,
赚取积分