2026-01-07 8:06 AM - last edited on 2026-01-07 8:19 AM by Andrew Neil
I'm using the X-CUBE-EEPROM library on my STM32C031G6Ux to store keys in flash memory. I configured eeprom_emul_conf.h so that the emulated EEPROM starts at 0x08007000, with 2 pages of 2 KB each, and set NB_OF_VARIABLES to 240.
When I tried saving 240 variables once using EE_WriteVariable32bits and reading them back with EE_ReadVariable8bits, everything worked fine.
However, when I repeat this process three times, writing stops once both pages are full, and the data is no longer read correctly.
I experienced similar issues even with 120 variables. Interestingly, adding EE_CleanUp after all writes solved the problem for 120 variables.
I then tried the same approach with 240 variables, calling EE_CleanUp after all write operations, but it still didn’t work.
Is there a reason for this behavior? Am I limited to storing only 120 variables in flash?