
22.10 Checksum (SUM)
For the following operation commands, a checksum is returned to verify the appropriateness of the result of com-
mand execution:
-
Flash memory erase command (0xF0)
-
Flash memory write command (0x30)
-
Flash memory SUM output command (0x30)
-
Flash memory read command (0x40)
-
RAM loader command (0x60)
-
Product ID code output command (0xC0)
-
Flash memory status output command (0xC3)
22.10.1
Calculation method
The checksum (SUM) is calculated with the sum of all bytes, and the obtained result is returned as a word.
The data is read in single-byte units, and the calculated result is returned as a word.
Example:
0xA1
If the data to be calculated consists of four bytes as shown
on the left, the checksum of the data is as follows:
0xB2
0xA1 + 0xB2 + 0xC3 + 0xD4 = 0x02EA
SUM (HIGH)= 0x02
SUM (LOW)= 0xEA
0xC3
0xD4
In the case of the product ID code output command and flash memory status output command, however, a
different calculation method is used. For more information, refer to
Table 22-19.22.10.2
Calculation data
Table 22-19 shows the data for which a checksum is calculated for each command.
Table 22-19 Data for which a Checksum Is Calculated
Operation command
Calculation data
Description
Flash memory erase command
All data in the erased area of flash memory
(whole or part of flash memory)
In the case of the chip erase, an entire area of the flash memory
is used. When the sector erase is executed, only the erased
area is used to calculate the checksum.
Flash memory write command
Data in the entire area of flash memory
Even if a part of the flash memory is written, the checksum of
the entire flash memory area (0x8000 to 0xFFFF) is calculated.
The data length, address, record type and checksum in Intel Hex
format are not included in the checksum.
Flash memory SUM output com-
mand
Flash memory read command
Data in the read area of flash memory
RAM loader command
RAM data written in the first received RAM
address through the last received RAM ad-
dress
The length of data, address, record type and checksum in Intel
Hex format are not included in the checksum.
Product ID code output command
9th through 18th bytes of transferred data
Flash memory status output com-
mand
9th through 12th bytes of transferred data
TMP89FM42
Page 375
RA003