Embedded application aspects
This section provides advice on how to overcome software limitations in embedded applications and how to fulfill the needs of different applications.
This section provides advice on how to overcome software limitations in embedded applications and how to fulfill the needs of different applications.
The flash memory data retention is typically 30 years at 85°C after cycling 1000 times (refer to the STM32 product datasheet for more information). Nothing specific is done in the EEPROM emulation driver to increase the EEPROM data retention. However, when a page transfer is initiated, all data (including long-lived data) is copied to a new flash memory page. This ensures an EEPROM data retention significantly higher than the original flash memory data retention.
The STM32U5 series FLASH_OPSR register indicates whether a flash memory operation was interrupted by a reset or not.
The current X-CUBE-EEPROM release does not use this register.
In association with power-failure detection (see Detecting power failures), this allows the EE_Init function to be called with the EE_CONDITIONAL_ERASE parameter, avoiding the need to use the EE_FORCE_ERASE parameter.
Additionally, the current EEPROM emulation erases the flash memory first empty line after each reset. This operation is avoided by using of the FLASH_OPSR register.
If no asynchronous reset can be generated by the application, the only way to corrupt the flash memory programming, or erasing operations is the case of power failure. The application can use the PVD not to generate a flash memory write or erase operation during the VDD ramp down. An example of this PVD (programmable voltage detector) usage is provided in the EEPROM example main application.
The decoupling capacitors or battery must be sized to provide enough power to the chip during the full write or erase operation and before the supply voltage goes below 1.7 V (minimal operating voltage) or before a BOR (brownout reset) is generated. In this case, the EE_CONDITIONAL_ERASE parameter of the EE_Init routine can be used. In all other cases, the EE_FORCE_ERASE parameter has to be used.
PVD is not available on STM32C0 series.
An EEPROM read command consists of performing flash memory reads from the highest to the lowest address in the ACTIVE and VALID pages. If the data to retrieve was the first to be written, this process can be quite long. Similarly, the page transfer searches for all virtual addresses used during EEPROM emulation and looks for corresponding data values. These read and transfer times can be quite long when the size of emulated EEPROM is large.
The worst-case read and write access times can be reduced by implementing a LUT (look up table) storing the element values in RAM. Although implementing a LUT does not affect the typical access times and is quite costly in terms of RAM space, it can still be an option implemented in a future revision of the EEPROM emulation driver.
The STM32 devices internal flash memory can be used advantageously in many applications to emulate an EEPROM. Even though the memory characteristics are quite different, this application note has shown that emulated EEPROM competes with real EEPROM in terms of:
| Date | Version | Changes |
|---|---|---|
| 11-Jul-2017 | 1 | Initial release. |
| 20-Sep-2018 | 2 |
Updated document to scope STM32L4 and STM32L4+ series devices. Updated:
Added Section 4.6: Computing the required size of flash memory for EEPROM emulation. |
| 01-Jun-2020 | 3 |
Updated:
|
| 03-Nov-2020 | 4 |
Extended document scope to STM32WL series. Updated:
Added Section 4.10: Cache coherency maintenance. |
| 16-Dec-2021 | 5 |
Extended document scope to STM32U5 series. Updated:
Added Section : The flash memory data retention is typically 30 years at 85°C after cycling 1000 times (refer to the STM32 product datasheet for more information). Nothing specific is done in the EEPROM emulation driver to increase the EEPROM data retention. However, when a page transfer is initiated, all data (including longlived data) is copied to a new flash memory page. This ensures an EEPROM data retention significantly higher than the original flash memory data retention.. Differentiated Flash memory page sizes between STM32WB55xx and STM32WB15xx series in Table 4: Flash memory properties. |
| 12-Jan-2023 | 6 |
Updated:
Added Section : The flash memory data retention is typically 30 years at 85°C after cycling 1000 times (refer to the STM32 product datasheet for more information). Nothing specific is done in the EEPROM emulation driver to increase the EEPROM data retention. However, when a page transfer is initiated, all data (including longlived data) is copied to a new flash memory page. This ensures an EEPROM data retention significantly higher than the original flash memory data retention. |
| 18-Jul-2023 | 7 |
Updated:
Added Section 4.5: High-cycle data area of flash memory |
| 25-Sep-2023 | 8 | Updated Table 11: EEPROM emulation timings for different targets |
| 15-Mar-2024 | 9 | Extended document scope to STM32U0 series. |
| 13-Mar-2025 | 10 | Extended document scope to STM32U3 series. |
| 18-Mar-2025 | 11 | Updated Table 3 Flash memory properties. |
| 06-Jul-2026 | 12 | Extended document scope to NUCLEO‑WL33CC1 and updated General information. |