
21
6 Fletcher Checksum
6.1 Calculation
The Fletcher checksum calculation results in two sums:
SUM1[R-
1] = D[0] + D[1] + …D[R-1]
SUM2[R-
1] = SUM1[0] + SUM1[1] + …SUM1[R-1]
where R = number of bytes in the EEPROM storage area from 00 through B5 (182d), including the
check bytes, and where all additions are modulo 256.
If no errors are found, SUM1[R-1] = SUM2[R-1] = 0
Example: 4 bytes of data, 2 check bytes, no errors
Hex Binary
Decimal
SUM1 SUM2
Data
C0
11000000 192
192
192
Data
E7
11100111 231
167
103
Data
E5
11100101 229
140
243
Data
04
00000100 4
144
131
Check Byte #1
ED
11101101 237
125
0
Check Byte #2
83
10000011 131
0
0
Example with single-bit error
Hex Binary
Decimal
SUM1 SUM2
Data
C0
11000000 192
192
192
Data
E7
11100111 231
167
103
Data
C5
11
0
00101 197
108
211
Data
04
00000100 4
112
67
Check Byte #1
ED
11101101 237
93
160
Check Byte #2
83
10000011 131
224
128
Example with two single-bit errors
Hex Binary
Decimal
SUM1 SUM2
Data
C2
110000
1
0 194
194
194
Data
E5
111001
0
1 229
167
105
Data
E5
11100101 229
140
245
Data
04
00000100 4
144
133
Check Byte #1
ED
11101101 237
125
2
Check Byte #2
83
10000011 131
0
2
Example with multiple errors
Hex Binary
Decimal
SUM1 SUM2
Data
64
0
1
1
00
1
00
100
100
100
Data
E7
11100111 231
75
175
Data
E5
11100101 229
48
223
Data
BC
1
0
111
100
188
236
203
Check Byte #1
ED
11101101 237
217
164
Check Byte #2
83
10000011 131
92
0