DLPU057A March 2018 – April 2022 DLP3030-Q1
This byte is used for verifying the integrity of the command packet. It is the sum of all the bytes in the current packet (from Command Byte to Data[n]).
For the command packet send by master,
Checksum = (Byte1 + Byte2 + … + Byten + Byten+1 + Byten+2) MOD 0x100
Where n = length of data (see Figure 1-3).
Please note that START_CHARACTER is not included in the checksum.
The MOD function is defined as,
R = a mod b
Where,
a = dividend
b = divisor
R = Remainder on division of a by b.
For the response packet send by slave for a read command (Figure 1-6), the checksum is computed as the sum of all bytes from Response Byte to Data[m]. This is shown below:
Checksum = (Bytek + Bytek+1 + … + Bytek+m+1) MOD 0x100
Where m = length of data returned by slave
k = byte index of response byte.