AN4061 EEPROM Emulation in STM32FOxx Microcontrollers Application Note

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.


AN4061 EEPROM Emulation in STM32FOxx Microcontrollers Application Note - cover page
Brand
STMicroelectronics
Category
microcontrollers
Document type
Application Note
Language
English
Pages
19
File format
PDF
File size
260 KB
Published
07 August, 2012
Updated
30 September, 2023
MD5 checksum
BD24ED1814ECE65E2A1CBF0EDA1054E4

About this manual

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.

What's inside

  • Main differences between external and emulated EEPROM
  • Implementing EEPROM emulation principle
  • EEPROM variable format and case of use
  • Embedded application aspects
  • Wear-leveling implementation example
  • Page header recovery in case of power loss
  • Cycling capability and page allocation

Specifications

API functionsthree functions for initialization, read data and write data
Write access time (Flash)from 3.8 us to 110 us
Erase time rangefrom 20 ms to 40 ms

Frequently asked questions

What is the main difference between external EEPROM and emulated EEPROM regarding erase operations?

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.

How many Flash pages are needed for EEPROM emulation?

The implementation requires at least two Flash memory pages of identical size allocated to non-volatile data.

Is the EEPROM emulation algorithm interrupted by a software reset?

No, in case of a software reset, the current Flash word write operation is not interrupted, though the overall EEPROM algorithm may be stopped.

Download PDF (260 KB)

More STMicroelectronics Manuals


View all STMicroelectronics manuals →