Page 1 of 1
Saving and storing a file to eeprom
Posted: Mon Feb 27, 2012 4:33 pm
by Ondra
Good day all. I would like to know what would be a good approach to storing, verifying the integrity then reading back a 128k file on an external eeprom chip. The file will be read through the RS232 port of the chip. The eeprom is connected via SPI.
Ondra
Re: Saving and storing a file to eeprom
Posted: Mon Feb 27, 2012 4:45 pm
by Benj
Hello Ondra,
One way is to insert CRC checks either at the end of the data or at the end of every section of data.
Eg if the EEPRO memory is split up into pages then you could use the last byte of each page to store the CRC byte for the page.
Another way would be to place the CRC byte for each full page of data into the last page of memory so you are not consuming room in each data page.
A CRC byte is basically calculated by running a exclusive or operation on each of your data bytes and then comparing the value with the stored CRC byte.
CRC = 0
CRC = CRC ^ DATABYTE0
CRC = CRC ^ DATABYTE1
...
CRC = CRC ^ DATABYTEn
if (CRC == DATABYTECRC)
The keyword you are looking for here is redundancy. Adding redundancy into a system allows for error checking and higher reliability. The down side is the more redundancy you add the less efficient the memory becomes.
Re: Saving and storing a file to eeprom
Posted: Mon Feb 27, 2012 5:24 pm
by Ondra
Thanks Ben
I'm not sure how I would implement this in Flowcode. I will look into it.
Any tutorials on the web or other wise that may help?
Ondra