FlashStorage_STM32 Library to use emulated-EEPROM. Now supports new STM32 core v2.0.0

FlashStorage_STM32 Library

How To Install Using Arduino Library Manager

Why do we need this FlashStorage_STM32 Library

Features

The FlashStorage_STM32 library, inspired from Cristian Maglie's FlashStorage, provides a convenient way to store and retrieve user's data using emulated-EEPROM, from the non-volatile flash memory of STM32F/L/H/G/WB/MP1.

The flash memory, generally used to store the firmware code, can also be used to store / retrieve more user's data and faster than from EEPROM. Thanks to the buffered data writing and reading, the flash access time is greatly reduced to increase the life of the flash.

Currently supported Boards

  1. STM32F/L/H/G/WB/MP1 boards with / without integrated EEPROM
  • Nucleo-144
  • Nucleo-64
  • Nucleo-32
  • Discovery
  • Generic STM32F0, STM32F1, STM32F2, STM32F3, STM32F4, STM32F7
  • STM32L0, STM32L1, STM32L4
  • STM32G0, STM32G4
  • STM32H7
  • STM32WB
  • STM32MP1
  • LoRa boards
  • 3-D printer boards
  • Generic Flight Controllers
  • Midatronics boards

Changelog

Releases v1.0.0

  1. Initial release to support STM32F/L/H/G/WB/MP1 board with / without integrated EEPROM
1 Like

Just got an interesting info from a user of this library EEPROM write works only in a fully erased Bluepill with Chinese clone micro CS32F103C8T6.

I have a blue pill with chinese CS32F103C8T6 in it. EEPROM write (commit and put) works only after I completely erase the chip using STM32CubeProgrammer. Once there is any data other than 0xFF in any location, it will no longer write to any location. Every sample programs failed, after the initial run in that chip. Everything is working as it should on my other bluepill with Genuine (I hope) STM32F103C8T6.

I really don't know what wrong with it: the chip (I guess) or hardware design.

So beware of cheap and cloned STM32 products.

Major Releases v1.1.0

  1. Add support to new STM32 core v2.0.0
  2. Add support to new STM32L5 and many new STM32F/L/H/G/WB/MP1 boards

Debug Terminal Output Samples

  1. The following is the sample terminal output when running example MQTT_ThingStream_Ethernet_STM32_LAN8720 on BLACK_F407VE board with LAN8720 Ethernet & STM32Ethernet Library demonstrating FlashStorage_STM32 feature to be used to store persistent data.

1.1. Without correct ThingStream MQTT Credentials. Enter Config Portal

Start MQTT_ThingStream_Ethernet_STM32_LAN8720 on BLACK_F407VE
Ethernet Shield type : LAN8720 Ethernet & STM32Ethernet Library
Ethernet_Manager_STM32 v1.3.0
DoubleResetDetector_Generic v1.0.3

EEPROM size = 16384, start = 0
Flag read = 0xd0d01234
doubleResetDetected
ClearFlag write = 0xd0d04321
[ETM] =====================
[ETM] DRD. Run ConfigPortal
[ETM] =====================
[ETM] EEPROMsz:4096
[ETM] EEPROM Length():16384
[ETM] CCSum=0x77e,RCSum=0x77e
[ETM] ChkCrR:CrCCsum=0x215e,CrRCsum=0x215e
[ETM] CrCCSum=215e,CrRCSum=215e
[ETM] Valid Stored Dynamic Data
[ETM] ======= Start Stored Config Data =======
[ETM] Header=STM32, BoardName=STM32-Ethernet
[ETM] StaticIP=
[ETM] Start connectEthernet using DHCP
[ETM] MAC:FE-98-FD-D6-DB-BA
[ETM] Dynamic IP OK, connected
[ETM] IP:192.168.2.149
[ETM] bg: isForcedConfigPortal = false
[ETM] bg:Stay forever in CP:DRD/MRD
Connected! IP address: 192.168.2.149
***************************************
esp32-sniffer/12345678/ble
***************************************
[ETM] h:Updating EEPROM. Please wait for reset
[ETM] SaveEEPROM,Sz=16384,DataSz=248,WCSum=0x8a9
[ETM] CrCCSum=0x2785
[ETM] h:Rst

1.2. Got correct ThingStream MQTT Credentials from Config Portal and saved to persistent EEPROM-emulated Flash

Start MQTT_ThingStream_Ethernet_STM32_LAN8720 on BLACK_F407VE
Ethernet Shield type : LAN8720 Ethernet & STM32Ethernet Library
Ethernet_Manager_STM32 v1.3.0
DoubleResetDetector_Generic v1.0.3

EEPROM size = 16384, start = 0
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[ETM] EEPROMsz:4096
[ETM] EEPROM Length():16384
[ETM] CCSum=0x8a9,RCSum=0x8a9
[ETM] ChkCrR:CrCCsum=0x2785,CrRCsum=0x2785
[ETM] CrCCSum=2785,CrRCSum=2785
[ETM] Valid Stored Dynamic Data
[ETM] ======= Start Stored Config Data =======
[ETM] Header=STM32, BoardName=STM32-Ethernet
[ETM] StaticIP=192.168.2.220
[ETM] Start connectEthernet using Static IP =192.168.2.220
[ETM] MAC:FE-98-FD-D6-DF-BA
[ETM] IP:192.168.2.220
[ETM] begin:Ethernet Connected.
Connected! IP address: 192.168.2.220
***************************************
esp32-sniffer/12345678/ble
***************************************

Your stored Credentials :
MQTT Server = mqtt.thingstream.io
Port = 1883
MQTT UserName = user_name
MQTT PWD = password
Client ID = device:12345678-1234-1234-1234-123456789abc
Attempting MQTT connection to mqtt.thingstream.io
...connected
Published connection message successfully!
Subcribed to: esp32-sniffer/12345678/ble
HStop doubleResetDetecting
ClearFlag write = 0xd0d04321

MQTT Message Send : esp32-sniffer/12345678/ble => Hello from MQTT_ThingStream on BLACK_F407VE with LAN8720 Ethernet & STM32Ethernet Library
H
MQTT Message receive [esp32-sniffer/12345678/ble] Hello from MQTT_ThingStream on BLACK_F407VE with LAN8720 Ethernet & STM32Ethernet Library

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.