I am trying to implement EEPROM Emulation on an STM32F07x using the driver supplied by ST. Problem is on attempting to initialise the emulated flash, the driver fails and always returns NO_VALID_PAGE. I have changed the defines for the Page Size and the EEPROM start address to match the Reference Manual but it doesn't work.
1 Answer
\$\begingroup\$
\$\endgroup\$
2
There is a subtle bug in the eeprom.h file. The calculation of the PAGE1_BASE_ADDRESS is based on 1Kb value page rather than using the define which is supposed to accommodate different page sizes in the MCU's.
Change the define
#define PAGE1_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x0400))
to:
#define PAGE1_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + PAGE_SIZE))