2 years, 3 months ago.

EEPROM Emulation on STM32F0 device

Hi,

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.

Comment on this question

1 Answer

2 years, 3 months ago.

Hi,

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:

Modifiy

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

You need to log in to post a question