Showing results for 
Search instead for 
Did you mean: 

EEProm library clean time


I was reading the documentation from:

about the eeprom lib.


Concerning the cleanup time, I don't follow where the number comes from.


I am using an L4 and there was only one example of an L4


It specifies a ~900MS cleanup time, which matches what I see in my use case

it then specifies the formula for this time as "The time taken to erase flash memory EEPROM pages = number of pages * tERASE."


looking at the data sheet for my L4 as well as the one in the table above the page erase time is 22ms. In my configuration I am using 14 pages for EEPROM so a cleanup should erase 7. but 7 * 22 is not 900, neither is 14 * 22. I am executing from flash so I know I'm stalling but I do not see the stall time specified anywhere in the reference manual. I also stopped the page erase from disabling instruction cache since the cleanup only erases pages used for data.


Any info on where the 900 comes from?

Senior III

What is "L4" (your MCU)?
the EEPROM full erase duration comes from the external EEPROM (not the MCU). Check the datasheet how long does it take to erase all in external EEPROM. 900ms might be reasonable (esp. if you have a huge memory size on external EEPROM).

These 900ms given might be just an example, for one particular chip. If you use a different or "larger chip" - this duration can vary.

STM32L4, specifically im using STM32L431RCT. It is not an external EEPROM, this is using the stm's internal flash and the linked EEPROM emulation library

Billy OWEN
ST Employee

Hi @dsauter 


The forum moderator had marked your post as needing a little more investigation and direct support. An online support case has been created on your behalf, please stand by for just a moment and you will hear from us.




It will be driven by the erase time of the FLASH sectors/pages of the underlying device.

If the garbage collection requires several passes and sweeps of the existing content you've strafed over multiple pages it might take a while to do safely and the least number of moves.

Honestly, if you understand your data, how and why you're storing it, you can likely get the numbers down significantly. ie to the point were it pre-erases resources it will need next time, and simply needs to journal write the data you need, because that's typically an order of magnitude quicker and frequent

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