2017-05-28 05:55 PM
I just would like to store one or two values in the in a non volatile memory and not sure how to do it.any ideas or a an example to start with.
Many thanks
2017-05-31 07:38 AM
hi, Raider!
You may first decide whether your data will be placed in flash or eeprom(if any).
For example,
I have a STM32L011 on my desk,
there are 512 bytes of eeprom.
I may use following code to write and read eeprom, using cubeMX
static uint32_t eepromData;
HAL_FLASHEx_DATAEEPROM_Unlock();
//write eeprom
HAL_FLASHEx_DATAEEPROM_Program(FLASH_TYPEPROGRAM_WORD,DATA_EEPROM_BASE, 0x12345678);
//read eeprom
memcpy(&eepromData,(void*)DATA_EEPROM_BASE,sizeof(uint32_t));
Similar examples are presented in CubeMx project examples in FLASH folder.
Good Luck!
Zt
.