官方文档中的流程中有多处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) |