This application note describes the software solution for substituting a standalone EEPROM by emulating the EEPROM mechanism using the on-chip Flash of STM32F0xx devices.
The document details how to replace standalone EEPROMs with on-chip Flash memory in low-cost embedded applications. It explains that while external EEPROMs do not require erase operations before rewriting, Flash memory requires specific software management to handle garbage collection and wear leveling.
The note provides a lightweight implementation using at least two Flash pages. The emulation driver offers a simple API for initialization, reading, and writing data, ensuring transparent operation for the user. It covers principles of page status switching, application examples with virtual addresses, memory footprint analysis, timing considerations, and strategies for improving Flash endurance through wear leveling.
| API functions | three functions for initialization, read data and write data |
|---|---|
| Write access time (Flash) | from 3.8 us to 110 us |
| Erase time range | from 20 ms to 40 ms |
External EEPROMs do not require an erase operation to free up space before data can be rewritten, whereas Flash memory requires special software management for garbage collection.
The implementation requires at least two Flash memory pages of identical size allocated to non-volatile data.
No, in case of a software reset, the current Flash word write operation is not interrupted, though the overall EEPROM algorithm may be stopped.