打印

请教一下,STM32 ISP中Checksum是怎么算的?

[复制链接]
4870|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
javenreal|  楼主 | 2011-6-16 17:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
官方文档中的流程中有多处checksum,请问其中的XOR是什么意思呢?:

文档中这样的描述:
1. checksum: received blocks of data bytes are XORed. A byte containing the computed
XOR of all previous bytes is added to the end of each communication (checksum byte).
By XORing all received bytes, data + checksum, the result at the end of the packet
must be 0x00

其中一处用到checksum的流程:
The host sends the bytes to the STM32 as follows:
Byte 1: 0x31
Byte 2: 0xCE
Wait for ACK
Byte 3 to byte 6: start address
byte 3: MSB
byte 6: LSB
Byte 7: Checksum: XOR (Byte3, Byte4, Byte5, Byte6)
Wait for ACK
Byte 8: Number of bytes to be received (0 < N ≤ 255)
N +1 data bytes:(Max 256 bytes)
Checksum byte: XOR (N, N+1 data bytes)
沙发
香水城| | 2011-6-16 17:42 | 只看该作者
XOR 就是异或运算。

使用特权

评论回复
板凳
电子发烧者| | 2018-11-30 14:50 | 只看该作者
本帖最后由 电子发烧者 于 2018-11-30 18:31 编辑
香水城 发表于 2011-6-16 17:42
XOR 就是异或运算。


使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

15

主题

48

帖子

1

粉丝