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
Saving and storing a file to eeprom
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Saving and storing a file to eeprom
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Saving and storing a file to eeprom
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
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