cancel
Showing results for 
Search instead for 
Did you mean: 

Main Flash memory endurance

kRaje.1
Associate II

Hi Team i have one doubt i am using stm32wle5cc controller and  stm32wle5cc controller have 256Kb flash memory and each page is 2Kb. and  stm32wle5cc controller  flash memory support  10k cycles write operations after completes 10k write operations what will happen to my memory. 
is their any FLASH HAL API's for stm32wl boards after reached maximum write operation cycles then data will move automatically to different page.
once you don't have any API"s related to this problem(Flash endurance) please give any solution regarding this problem.

7 REPLIES 7
TDK
Guru

ST guarantees at least 10k write cycles. After that, at some point, the flash will fail. You will try to write 0xAA and it will write 0xBB instead, or some other such nonsense.

https://www.embedded.com/flash-101-errors-in-nand-flash/#:~:text=The%20data%20stored%20in%20Flash,it%20from%20time%20to%20time.

There is no automatic wear leveling in the chip.

The solution is to write/erase less frequently, or load level in a smart manner. If you only need to store a few bytes, consider writing them any filling up the page before erasing.

If you feel a post has answered your question, please click "Accept as Solution".
Pavel A.
Evangelist III

Not sure if this is relevant for the WL series - newer STM32s such as U5 seem to have "enhanced endurance". (see the pdf, page 3)

IIRC this has been discussed on this forum (before migration) but I cannot find.  It looks like (warning! wild speculation!) there are few reserved sectors which automatically engage and substitute failing "main" sectors, transparently to the firmware. This occurs likely when erase failure is detected (some bits not flipped to 1?). The projected use case is to boost the life time of few sectors that are very frequently updated (configuration etc.) but should help with any random sector failure (?)

Hi Team it means their is no solution from st electronics regarding Flash endurance. is their any software from  st electronics like HAL API's Regarding Flash endurance.

it means is their any solution after 10k cycle write and read operation done on flash memory. i mean is their any HAL API's those can detect and  moved the data to  another page after 10k cycles completed.in STM32WL series Controllers.

Danish1
Lead II

The HAL libraries show you how to use the peripherals.

ST also have EEPROM-emulation examples where you allocate a few FLASH pages. When you do an update to a virtual address in the virtual EEPROM, both the address and the new value are tacked onto the end of the list of currently-written values. And as one page of FLASH fills up, it moves to the next page. Eventually it goes back to the beginning. This shares wear between all the FLASH pages you have allocated, as well as avoiding re-writing of values that haven't changed. I think this is well-thought-through code, which shouldn't lose the values even if the stm32 loses power part-way-through a FLASH update.

If there isn't one for your stm32, I recommend that you look at other stm32, and then study the code.

The solution is that it will work for 10,000 times. And after that, there are no guarantees. There are no HAL functions or other software capabilities available to extend the guarantee past 10,000 times.

If you feel a post has answered your question, please click "Accept as Solution".

"stm32wle5cc controller  flash memory support  10k cycles write operations after completes 10k write operations what will happen to my memory."

Usability will degrade.. Think of it like tires on a car, there's a usable life-span, depending on driving after 50,000 Miles they are likely to be getting bald, might have some flat spots, and generally not be 100% effective in stopping the vehicle.

You need to think long, and hard, as to WHY you need to be putting 10K cycles on the memory cells, and if there's a better approach to your problem, say via journalling, or wear management, or how often you need to write to this type of memory, vs other memories that don't wear. ie BKPRAM / NVRAM

Some units rate a portion of memory to 100K cycles, but this is including estimates on wear to the charge pump and programming/erase units, as the high internal voltages degrade the silicon.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..