# EEPROM Emulation driver does not work when Page Sizes are 2KB

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.

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))

• 3 years later and this error is still present in STM32Cube F4 library version 1.24, release date 08-February-2019 :/ – Galaxy Aug 20 at 12:27
• Maybe someone should tell them ;) – Rev1.0 Aug 20 at 13:48