Saving and storing a file to eeprom

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Saving and storing a file to eeprom

Post 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

User avatar
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

Post 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.

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: Saving and storing a file to eeprom

Post 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

Post Reply