4 years, 5 months ago.

EEPROM Emulation on STM32F0 device


I am using NUCLEO-F072 board, with STM32F072RB microcontroller. I am trying to emulate EEPROM in flash of the mcu. I am following the reference code for HAL flash driver. I am having a problem with read/write in the flash region. On erasing and writing in Flash, I am getting status as HAL_OK. But on reading the same location I am getting read value as 0xFFFF. I am sharing the code files. Someone, please help me to solve the problem.

/media/uploads/Akshat123/main.cpp /media/uploads/Akshat123/eeprom.h /media/uploads/Akshat123/eeprom.cpp

Thank you.

1 Answer

4 years, 5 months ago.


I think that you are making a mistake when calling read.

Your code is

readValue = readEEPROMHalfWord(DEVICE_STATUS);

So... you are reading the address 0x0000 when you really wish to read the address of variable "i". Please try:


readValue = readEEPROMHalfWord(i);

Best regards

Hi Felícito,

Thanks for your answer. Actually, read and write method takes EEPROM address as a parameter. And i is just an incremental integer. Please check the read and write method.

Thank you.

posted by Kishore Chilakala 29 Jun 2017