SRAM, DRAM, NOR, NAND, EEPROM, FRAM, MRAM, eMMC: memory types and how to choose
There's no memory that is "non-volatile, rewritable, and fast" all at once. Every memory gives up endurance, capacity, speed, or price, so this is organized to be looked up by application.
Start with three groups
It helps to split memory into three groups: volatile memory that loses its contents when power is removed (SRAM, DRAM); the flash family that keeps its contents and stores electrons in a floating gate (NOR, NAND, eMMC, EEPROM); and the newer non-volatile types that keep their contents and can be written byte by byte (FRAM, MRAM). Except for EEPROM, the flash family erases in blocks.
Comparing capacity and endurance
| Type | Volatile | Capacity | Write granularity | Endurance | Write time |
|---|---|---|---|---|---|
| SRAM | Yes | Few kB–few MB | Byte | Unlimited | Few ns |
| DRAM / SDRAM / DDR | Yes | 64MB–few GB | Byte (burst) | Unlimited | Tens of ns |
| NOR flash | No | 1MB–256MB | Write: byte, erase: sector (4k–64kB) | 100k cycles | Write µs, erase 100s of ms |
| NAND flash (raw) | No | 1GB–few TB | Write: page (few kB), erase: block (MB) | SLC 100k, TLC 3k | Write 100s of µs, erase few ms |
| eMMC | No | 4GB–256GB | Sector (512B, NAND inside) | Managed by controller | 100s of µs+ |
| EEPROM | No | 1kbit–4Mbit | Byte | 1M cycles | 5ms (page) |
| FRAM | No | 4kbit–16Mbit | Byte | 10¹⁴ cycles | Tens of ns (no wait) |
| MRAM | No | 1Mbit–1Gbit | Byte | Unlimited (10¹⁵+) | Tens of ns |
Volatile: SRAM and DRAM
SRAM is a flip-flop, six transistors per bit. It needs no refresh and reads and writes in a few ns. The cell is large, so capacity tops out at tens to hundreds of kB on-chip and a few MB external.
DRAM is one transistor and one capacitor per bit. The charge leaks, so it must be read and rewritten (refreshed) every few tens of ms. The cell is small, so gigabytes are cheap. A memory controller on the processor side handles refresh and timing, so a microcontroller without one cannot connect to DRAM. Processors that run Linux have a DDR controller.
The rule of thumb is simple: SRAM for a few MB or less, DRAM above that. The middle ground of a few MB is filled by QSPI pseudo-SRAM (PSRAM, DRAM inside with refresh built in).
The flash family: NOR, NAND, EEPROM, eMMC
Flash stores data by trapping electrons in a floating gate. Writing (adding electrons) can be done bit by bit, but erasing (removing electrons) can only be done in a larger block. Most of the differences below follow from that.
NOR flash connects its cells in parallel, so any address can be read at random. The processor can execute instructions straight from it (XIP, Execute In Place), which makes it the home for boot code. An erase takes hundreds of ms.
NAND flash chains its cells in series to pack in more density. Bit errors are routine, so ECC and bad-block management are mandatory. Endurance is 100k cycles for SLC, 10k for MLC, 3k for TLC, and 1k for QLC: more bits per cell is cheaper but weaker.
eMMC puts a controller on top of NAND that handles ECC, wear leveling, and bad-block management internally. From the outside it just reads and writes 512B sectors, and it's the standard home for a Linux root filesystem.
EEPROM is small non-volatile memory that erases and writes byte by byte. A write takes about 5ms, but it survives a million cycles. It holds settings, calibration data, and serial numbers.
FRAM and MRAM: byte-writable non-volatile memory
FRAM (ferroelectric RAM) stores data as the polarization direction of a ferroelectric material. It writes byte by byte with no wait (write cycle of tens of ns) and survives 10¹⁴ write cycles. There's no 5ms write wait like EEPROM, and a power loss mid-write doesn't corrupt the data. Capacity tops out around 16Mbit and it costs more than EEPROM.
MRAM (magnetoresistive RAM) stores data as the magnetization direction of a magnetic layer. Endurance is effectively unlimited, and some parts match SRAM's speed and interface, which is why it's used to replace battery-backed SRAM. It reaches the 1Gbit class, but costs tens of times more than DRAM.
Both suit applications that write often, may lose power unexpectedly, and don't need much capacity. Doing the same in flash needs wear leveling and power-loss protection, and adding one FRAM chip usually costs less.
Choosing by application
| Application | Choice | Reason and caveats |
|---|---|---|
| Boot code / firmware | On-chip MCU flash; QSPI NOR if that's not enough | Supports XIP and fast random reads. With NAND, add a small NOR or use eMMC's boot partition |
| Working memory | On-chip SRAM up to a few hundred kB; PSRAM or external SRAM for a few MB; DDR above that | DDR assumes a processor with a memory controller |
| Settings / calibration data (written a few times a year to a few times a day) | I²C EEPROM | On-chip flash emulation works too, but calculate the erase count and granularity |
| Running totals / counters / state (written every second to every minute) | FRAM or MRAM | Written every second, EEPROM uses up its million cycles in about two weeks |
| Logs / measurement data (large volume, append-only) | SPI NAND, eMMC, or an SD card | Raw NAND means providing your own ECC and bad-block management |
| An OS filesystem | eMMC | SD cards bring insertion/removal wear and quality risk |
| The last-known state that must survive a power loss | FRAM or MRAM | A power loss mid-write doesn't corrupt the data |
Common mistakes
- Writing to flash every second hits the erase-cycle limit within a day or two. Erasing a 4kB sector every time you rewrite 16 bytes of settings also ends the part's life at 100k cycles. Buffer in RAM and write less often, implement wear leveling (rotate the write location within the sector), or keep settings in a separate EEPROM or FRAM.
- An EEPROM doesn't respond during its 5ms write window. Wait with ACK polling.
- If power drops during a write, both flash and EEPROM leave the page in an undefined state. Write alternately to two locations and pick the valid one by CRC, or use FRAM.
- Raw NAND has bad blocks from the factory and bits flip in use, so ECC is mandatory even for SLC.
- eMMC is TLC NAND inside, with a cap on total bytes written (TBW). For frequent logging, calculate the lifespan and consider SLC mode or an industrial-grade part.
- DDR3 and above need length matching, controlled impedance, and termination, which is tough on a 4-layer board. Consider a module (SOM).
- Some MRAM parts corrupt data near a magnet (speaker, relay, Hall sensor). Check the datasheet's field immunity.
Frequently asked questions
What's the difference between EEPROM and flash?
Are SDRAM and DDR different things?
What's the difference between eMMC and an SD card?
Should I choose FRAM or MRAM?
Standards and references
- JEDEC JESD79 series / JESD84 (eMMC) — DDR SDRAM and eMMC standards
- ONFI (Open NAND Flash Interface) specification — Raw NAND interface and ECC requirements
- Individual memory vendors' datasheets — Endurance, data retention, write time, TBW