Writing to memory

Hi, I would like to ask if there is an option of writing, calculations from software into flash memory, the thing is that 6KB of eeprom is not enough memory, for writing measurements from long term data collection.
Thank you

Hi, you need to use STM32 HAL library functions from
sdk/stm/hal/inc/stm32l0xx_hal_flash.h
and
sdk/stm/hal/inc/stm32l0xx_hal_flash_ex.h (which contains also erase commands)

You need unlock the flash controller, erase the correct flash page (if it does not contain 0xFFs.), write data and lock page.

In case of more rewrite-demanding we suggest using some libraries that manages wear-leveling.
Also STM has free EEPROM emulation driver, that is using Flash as a NVM storage and manages some wear leveling and garbage collection.
https://www.st.com/resource/en/application_note/an4894-eeprom-emulation-techniques-and-software-for-stm32-microcontrollers-stmicroelectronics.pdf

1 Like