Friday, January 21, 2011

How to check a ROM of a micrcontroller?

First of all checking means what?
-dump some code into the rom and seeing weather it is saved correctly or not.

process:
-we are going to use concept called "CHECKSUM CALCULATION" .
-Checksum process uses a byte called "CHECKSUM_BYTE".
-Checksum_byte is the extra byte tagged at the end of series of bytes of data.

process to calculate checksum_byte:
-Add the code bytes together and drop the carry .
-Then take the 2's complement of the total sum it becomes the last byte of the series.

How to perform Checksum Operation:
-Add all the bytes including the checksum byte, the result should be zero.
-If not zero then one or more bytes has been changed.


Small Example:
Assume that we have 4 bytes of hexadecimal data: 25H, 62H, 3FH, and
52H.
(a) Find the checksum byte,
(b) perform the checksum operation to ensure data integrity, and
(c) if the second byte 62H has been changed to 22H, show how checksum detects the error.
Solution:
(a) Find the checksum byte.

25H+62H+3FH+52H=118H .
By droping the carry we get 18H.
checksum_byte = 2's complement of 18H i.e., E8H
Therefore we got the checksum_byte = E8H

(b) performing the checksum operation

25H+62H+3FH+52H+E8H= 200H . Dropping the carry we get 00H ie., no byte is corrupted. (indirectly ROM is good)

(c) If second byte 62H is changed to 22H then,

25H+22H+3FH+52H+E8H= 1C0H . Dropping the carry we get C0H which is not zero ,which means one or more bytes are corrupted.



Once we had dis in our external exams and at that time I was aware of this concept, and was not able to answer the question .
I finally cracked the answer when I was really going deep into the subject .

Here's the proces:

No comments:

Post a Comment