FlashStorage_STM32 operation and flash life optimisation

Post Reply
Phono
Posts: 73
Joined: Thu Mar 19, 2020 9:32 am
Answers: 1

FlashStorage_STM32 operation and flash life optimisation

Post by Phono »

Hi,
I used to use the STM32F1 version of this library which was different in that what was stored was a couple {index, value} and each write was done in a new 32-bit word of the flash, so that a flash erase was only performed when the flash page was full, which spared the life time of the flash memory.
I am now using a STM32H7 and this library is no more compatible so I am considering moving to FlashStorage_STM32.
The new library is much more flexible by allowing to write objects of arbitrary sizes, but apparently it relies on physical addresses in memory so every update is performed at the same addresses.
Am I right saying this? If yes, wouldn't it be useful to write each time to a different location? Would this save the flash life ?
GonzoG
Posts: 517
Joined: Wed Jan 15, 2020 11:30 am
Answers: 37
Location: Prudnik, Poland

Re: FlashStorage_STM32 operation and flash life optimisation

Post by GonzoG »

You could use STM's EEPROM library. It uses chip's flash memory to emulate EEPROM. Downside - it uses 1 or 2 pages of flash memory and you can only store 1/4 of the size of memory used for eeprom.

Don't think that it uses physical address. That's because you cannot erase only part of a flash memory page, you need to erase whole page. So if a chip has 16kB pages, this library would erase whole 16kB just to update 1B.
It probably works same way as STM's virtual EEPROM. It writes data sequentially with an index (address) and return the most recent data with index you want.
Post Reply

Return to “Forum rules, FAQs and HowTo's”