EMBEDDED SYSTEMS & MICROCONTROLLERS · PAGE 40
External Storage: Flash Chips and Memory Cards
When the on-chip memory is not enough.
Serial flash chips connect over SPI and store from kilobytes to megabytes. Memory cards also speak SPI in a simple mode.
Flash must be erased in blocks before rewriting, and each block survives a limited number of erases. Spread writes around, a technique called wear levelling.
For logging, write in batches and flush data before power is lost.