Home / Learn Embedded C / EEPROM and Non-Volatile Storage

EEPROM and Non-Volatile Storage

Where firmware keeps small settings that must survive a power cycle.

The gistWhere firmware keeps small settings that must survive a power cycle.

The idea, explained simply

In plain terms

EEPROM (and similar non-volatile storage) is memory that keeps its contents even with power off, used for small amounts of data that must survive resets — like a saved Wi-Fi password or calibration value.

Why we use it

RAM is wiped every time power is lost; flash is usually erased/written in large blocks, not single bytes — EEPROM (built into many chips, or external) fills the gap for small, frequently-updated persistent data.

Under the hood

EEPROM is typically read and written a byte (or a few bytes) at a time via simple read/write functions provided by the chip's standard library, and has a limited number of write cycles per cell (often ~100,000), which is why wear leveling matters (next lesson).

Real-world use

  • Saved configuration
  • Calibration data
  • Device settings that must survive reboot

Try it

Simulating an EEPROM-style byte read and writeC: edit and run

A real EEPROM driver calls chip-specific read/write functions instead of a plain array, but the byte-at-a-time model is the same.

StorageSurvives power loss?Typical write granularityTypical use
RAMNoByteWorking variables
EEPROMYesByte (slow)Small settings, calibration data
Flash (program memory)YesBlock/page (fast per block, but whole blocks)Code, and sometimes larger saved data

Try it: storing several settings bytes at once

Writing and reading back a small block of EEPROM-style settingsC: edit and run

Real EEPROM libraries use a fixed memory map like this, so each setting always lives at the same known address across power cycles.

Quick quiz

1. What is EEPROM typically used for in embedded systems?