Hi!
In AN2399 it says that the checksum is calculated as the 1's complement of the sum of flash memory from 0xF600 to 0xF7FD, but in the example firmware code (last row in icp-kbd.asm in AN2399SW.ZIP) I can see it is calculated as the two's complement. I have verified this by using the CHECKSUM_ADD method in the .prm file and calculated it myself.
This is what I added in the default.prm file:
CHECKSUM
CHECKSUM_ENTRY
METHOD_ADD SIZE 1
OF READ_ONLY 0xF600 TO 0xF7FD
INTO READ_ONLY 0xF7FE SIZE 2
UNDEFINED 0xFF
END
END
Then I just did a one's complement of the sum and got the value 0x0994.
But in the last row in source file icp-kbd.asm it says:
dc.w $0995 ;;ICP_Flag (Checksum)
And also, in JB16_ICP.ASM in AN2399 it is just calculated as the sum with no complement.
What method is the correct one to use? 1's complement, 2's complement or just the sum?