Definition
Flash wear is the gradual damage that erasing and programming cause to the cells of flash memory §6.6, the storage that keeps data without power and must erase a whole block before rewriting any of it. Endurance is the number of program/erase cycles, each one erase of a block followed by programming it, that the manufacturer guarantees every block survives while still storing data reliably. The nRF52840 §6.4 microcontroller §6.1, for example, guarantees at least 10,000 cycles per 4096-byte page. The guarantee holds only within the stated temperature range and supply voltages.
The idea
A device saves its state once a minute, and each save appends a small record to a log in flash memory. Endurance is counted in cycles, and every cycle contains one erase of a whole block. A log erases a block only after the block has filled, so the block’s count rises once per fill, however many records the fill took. Bigger records and more frequent saves fill blocks faster, and more blocks taking turns share the erases.
The damage is physical. A cell holds a bit as charge in an insulated region, and each program or erase pushes charge through a thin insulating film and degrades it slightly. Worn cells program and erase more slowly and hold their charge for less time, until data no longer reads back reliably. The rated endurance is a guaranteed floor for planning, not the point of failure, and it promises nothing beyond itself.
How it works
An estimate of life follows the erases.
Effective record size : the bytes one update really occupies, meaning the value plus its header or metadata, its check value and its padding up to the write unit.
Records per sector , where is the space in one sector available for records and means rounded down to a whole number; a record that does not fit whole goes to the next sector.
Updates per round. A log that uses its sectors in turn absorbs updates in one trip round the ring and erases each sector once.
Total updates. Each sector may be erased times, the endurance, so the area absorbs updates.
Life. Divide by the update rate , in updates per day.
Three corrections usually lower the result.
Copies. Garbage collection §8.16 copies live records forward before erasing a sector, and the copies take room that new updates would otherwise use. If copies fill a fraction of each sector on average, only new updates fit per sector.
Hot spots. A value kept at a fixed place, which must be erased for every change, wears at its own, much higher rate, and a device lasts only as long as its most worn block.
Conditions. Outside the stated temperature range and supply voltages, the endurance guarantee no longer applies.
Endurance is one of two limits. The other is retention, the time that programmed data stays readable without power, which heat and wear shorten. Spreading erases evenly over blocks is called wear leveling. A log that rotates through its sectors levels wear among them, and the controller inside a memory card or solid-state drive levels wear over the whole device. The flash memory built into a microcontroller has no such controller, so the storage software must do it.
Worked example
Take the nRF52840: sectors of 4096 bytes and endurance cycles. Let each sector keep 16 bytes for bookkeeping, leaving bytes for records. A record holds a 4-byte value and 8 bytes of metadata, so bytes and records per sector. The log has sectors, and the device saves once a minute, updates per day. Ignoring copies, life is about 12.9 years. Each sector is erased once every updates, that is times a day.
Change one factor at a time.
Record size. A 40-byte value with the same 8 bytes of metadata gives and , a quarter of 340. Life falls to days, about 3.2 years: four times larger records, four times shorter life.
Update frequency. Saving every 10 seconds gives per day, six times as many, and life falls to days, about 2.2 years.
Rotation. Eight sectors instead of two give days, about 52 years, four times the original.
Copies. If collection copies fill a quarter of every sector, , only new records fit per sector, and the original life shrinks by the same factor to about 3542 days, 9.7 years.
Hot spot. Keeping the value at one fixed place, erased before every save, costs one erase per update: days of guaranteed life.
The documentation of Zephyr §6.33 NVS (Non-Volatile Storage), the flash storage library of the Zephyr RTOS (real-time operating system), gives the same estimate in minutes, without the rounding down of step 2.
Stated precisely
Let be the number of sectors that take turns, the bytes per sector available for records, the effective bytes per update, the average fraction of each sector taken by copies, with , the guaranteed erase cycles per sector and the updates per day. The number of days until the first sector reaches erases is The formula assumes that:
every update appends exactly one record of bytes, and nothing else writes to the area;
the sectors are erased in strict rotation, so that all reach the same count together;
the update rate stays at ;
the device stays within the temperature range and supply voltages for which is guaranteed.
is the period of guaranteed operation, not a predicted date of failure. Beyond the specification promises nothing.
Limits and common mistakes
The endurance figure is a minimum guaranteed within stated temperature and voltage limits, not a measured average and not a promise of calendar life. A different chip, or the same chip run hotter, needs its own figure.
Writing more bytes does not by itself wear flash faster; erasing does. Two designs that write the same bytes can differ greatly in wear if one of them erases more often, for example by rewriting data in place instead of appending.
The estimate covers only the log’s own area and the traffic it models. Another writer in the same sectors, a value at a fixed place, or a reset loop that saves a record at every start-up can use up endurance far faster than the normal update rate suggests. A store that skips a write whose value equals the current one, as Zephyr NVS does, removes those updates from .
Wear-out is a separate failure from a torn write §8.19, poor retention or a software bug; an endurance estimate covers none of them.
Questions answered
How do record size, update frequency, and sector rotation affect estimated life?
Estimated life is the number of updates a storage area can absorb before its sectors reach their guaranteed erase count, divided by the update rate: life in days , for sectors taking turns, usable bytes per sector, bytes per record, guaranteed erases per sector and updates per day, where means rounded down. All three factors act through the erase rate, because flash memory wears by erase cycles.
Record size: a larger record, counting metadata, check values and padding, fills a sector sooner, so the sector is erased more often. With 4080 usable bytes per sector, 48-byte records instead of 12-byte ones give 85 records per sector instead of 340, and a quarter of the life. Update frequency divides life directly. Sector rotation multiplies it, because more sectors share the same erases: 8 sectors instead of 2 give four times the life, but only if all sectors really take turns and nothing is rewritten at a fixed place. Copies made by garbage collection lower the result by the fraction of each sector they fill, and the figure holds only within the chip’s stated temperature and voltage limits.
Related entries: Write amplification (§8.18), Circular log (§8.14), Flash memory (§6.6), Garbage collection (§8.16). Further reading: [12, 56].