Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork87
EEPROM emulation for stm32.
License
nimaltd/ee
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A simple and reliableEEPROM emulation library written in C for STM32 (HAL-based).
This library allows you tostore and retrieve non-volatile data using the STM32's internal Flash memory — ideal for devices that do not include dedicated EEPROM.
It provides a lightweight API forinitialization, read, write, format, andcapacity management, making it easy to integrate into any STM32 project.
It supports all STM32 series.
- 🧩 Fullyblocking, synchronous operation
- 💾 Usesinternal Flash for data storage
- 🧱 Configurablepage/sector size and memory layout (Auto and Manual)
- 🧠 Supportsdata structure mapping for easy use
- ⚙️ Works with bothsingle-bank and dual-bank Flash configurations
- 🔐 Safe write mechanism to protect existing data
- 📂 Clean, modular, and portable API
You can add the library to your STM32 project in two ways:
Add these files to your project:
ee.hee.cee_config.h
Include them in your application source files and compile.
Future support will be available via the official STM32 pack repository.
Defines page/sector sizes and optional manual Flash configuration or Use Auto Selection (define EE_MANUAL_CONFIG = 0).
/* USER CODE BEGIN EE_CONFIGURATION */#defineEE_MANUAL_CONFIG 0#if (EE_MANUAL_CONFIG==1)#defineEE_SELECTED_PAGE_SECTOR_NUMBER 16#defineEE_SELECTED_PAGE_SECTOR_SIZE EE_PAGE_SECTOR_SIZE_1K#defineEE_SELECTED_BANK FLASH_BANK_1#defineEE_SELECTED_ADDRESS 0x08000000#endif/* USER CODE END EE_CONFIGURATION */
| Function | Description |
|---|---|
ee_init() | Initialize EEPROM emulation module with a data buffer |
ee_capacity() | Get total emulated EEPROM capacity (in bytes) |
ee_format() | Erase and format the EEPROM area in Flash memory |
ee_read() | Load data from Flash into RAM buffer |
ee_write() | Save (write) the RAM buffer back to Flash memory |
Use your data structure like this:
#include"ee.h"typedefstruct{uint32_tval1;int16_tval2;int8_tval3;floatval4;}stotrage_t;stotrage_tee_data;intmain(void){// HAL / system init ...// ...ee_init(&ee_data,sizeof(stotrage_t));ee_read();ee_data.val1=10000;ee_data.val2=-202;ee_data.val3=-3;ee_data.val4=4.5f;ee_write();while (1) {// main loop... }}
- Flash erase/write cycles arelimited — avoid frequent writes.
- For some series should enable 'EE_MANUAL_CONFIG'.
If this project helped you, please⭐ star the repo and consider supporting:
Licensed under the terms in theLICENSE.
About
EEPROM emulation for stm32.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Contributors5
Uh oh!
There was an error while loading.Please reload this page.
