How can one validate the data/contents read from memory[eeprom/flash] is correct or not?

What i have done is,
1.) read_mem(location, readBuf1,128)
2.) read_mem(location, readBuf2,128)
3.) if 0 == memcmp(readBuf1,readaBuf2,128), then VALID else INVALID

What are Pros and Cons of above steps?
Any another ways to do it?

  • \$\begingroup\$ Is this an academic assignment? \$\endgroup\$ – Nick Alexeev Feb 6 '17 at 5:37

If the contents ot the memory are corrupted, reading them twice won't help. The usual method to validate memory contents is using additional data like checksum or CRC


If reliability is an issue, one can use a flash memory that has builtin checksums. 32 MB flash with ECC

Simple redundancy is NOT a good test; if a data bit were stuck high or low, it would pass that test. At least, invert the bits.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.