EEPROM Emulation with Wear-Leveling for 8-Bit Flash MCUs

Silicon Labs C8051F

Application Note AN798
October 2013

This application note demonstrates a way to use the flash memory of an 8-bit flash MCU to emulate singlevariable-rewritable EEPROM memory through firmware. The example API provided enables reading and writing of single variables to non-volatile flash memory. The erase-rewrite algorithm implements wear-leveling on the flash by distributing page erases.

EEPROM and Flash-Based Memory EEPROM stands for Electrically Erasable Programmable Read-Only Memory and is a type of nonvolatile memory that is byte erasable. Therefore, it is often used to store small amounts of data that must be saved when power is removed. The main difference between the flash memory used by the C8051Fxxx MCU families for non-volatile data storage and EEPROM is the erasable unit size. Flash memory is block-erasable, which means that bytes cannot be erased individually. Instead, a block consisting of several bytes (typically 512 or 1024 on the C8051Fxxx devices) must be erased at the same time. By using firmware, it is possible to emulate individually erasable and rewritable byte memory using block-erasable flash memory.

Download Application Note AN798 (61 Kb)

EEPROM Emulation Page Status Flow
EEPROM Emulation Page Status Flow