EEPROM Corruption

From Black Metal Forest
Revision as of 21:00, 19 April 2019 by Thousandparadox (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Quadrature Protection

This is a method I made up to combat corruption. I call it Quadrature Protection because it sounds cool. The idea here is to divide the EEPROM into 4 copies. So to have 1K of Non Volatile Memory would require a 4K of space, in the case of EEPROM this usually only a few cents more.

When a write is made to the memory, it is written four times. If power is lost during the write process, it will likely only affect one of the four copies. Later when a Read operation is performed, the copies are compared, and the most exact duplicates are regarded as the correct data.

Why 4 Copies?

If a 2 Copy system was used, it would be impossible to tell which copy was the uncorrupted data. If a 3 copy system was used, a situation could arise where the first copy would contain old data, the second copy could contain corrupted data, and the third copy would have new data. Again it would be impossible to tell which of the three copies was the truth. So 4 Copies is the ideal amount of copies, as well as just fitting well into eeprom that always comes in sizes that can be evenly divided.

Quadrature Protection should not be used as the only form of protection. It's primary purpose is to recover from a data corruption without losing information.

To supplement Quadrature Protection, a CRC-32 can calculated and placed in each of the four copies. When the Quadrature are read, copies that fail the CRC can be thrown out.

Ferroelectric Memory

EEPROM may become superseded in many applications by FRAM. FRAM uses silicon level Ferrite cores and magnetism to store information and does not suffer from the limited write cycles of EEPROM. It is very similar to Magnetic Core Memory from the 1960's but on a microscopic scale. A 16K EEPROM goes for only pennys on Digikey, while a 16K FRAM IC will cost you around a dollar, still cheap if the application would benefit. I used FRAM in the DAX robot battery pack to guarantee the preservation the the State Of Charge by writing it to the FRAM every Four seconds. In case of a software glitch or unexpected power down the SOC won't be lost or out of date. Writing every Four seconds will rack up 31 Million writes over it's predicted Four years of on time, too much for EEPROM. However, even though FRAM won't ware out like EEPROM, there are still other ways for FRAM information to become corrupted.


EEPROM Ware Leveling

EEPROM cells read 1 by default, or 0xFF for each byte. Every time a bit is set to 0, the cell is damaged slightly. Microscopic defects in a EEPROM cell may make it more secseptable to failer than other cells. Knowing this, We can write our information to a different spot every time in order no focus to much damage onto a few cells.