2020-01-27 01:16 AM
2020-01-27 02:30 AM
From the stm32g030k6 data sheet, I see in Table 42 that the FLASH memory can endure only Nend = 1000 cycles.
Of course you can only program a bit from 1 to 0; this has to be done in 64-bit blocks.
And then erase it from 0 back to 1, in 2kbyte pages.
That amounts to one cycle.
Because of the asymmetry in program and erase sizes, EEPROM-emulation code typically allocates at least 2 pages of FLASH then stores address-value pairs, so that you can write new values to the same emulated address and read back the most-recently-written value without having to erase the FLASH and waste one cycle on every value change. See (for example) ST application note AN3969 "EEPROM emulation in STM32F40x/STM32F41x microcontrollers"
Hope this helps,
Danish