From e49849b402365049147649ed5e44fd34da8bf5a9 Mon Sep 17 00:00:00 2001 From: "Frederic.Pillon" Date: Fri, 30 Jun 2017 17:09:53 +0200 Subject: [PATCH] Fix #47 eeprom issue Signed-off-by: Frederic.Pillon --- cores/arduino/stm32/stm32_eeprom.c | 2 +- cores/arduino/stm32/stm32_eeprom.h | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cores/arduino/stm32/stm32_eeprom.c b/cores/arduino/stm32/stm32_eeprom.c index b832568ed5..2a9e2e2334 100644 --- a/cores/arduino/stm32/stm32_eeprom.c +++ b/cores/arduino/stm32/stm32_eeprom.c @@ -180,8 +180,8 @@ void set_data_to_flash(void) EraseInitStruct.Page = FLASH_PAGE_NUMBER; #else // STM32F4xx EraseInitStruct.PageAddress = FLASH_BASE_ADDRESS; - EraseInitStruct.NbPages = 1; #endif + EraseInitStruct.NbPages = 1; if(HAL_FLASH_Unlock() == HAL_OK) { #ifdef STM32L0xx diff --git a/cores/arduino/stm32/stm32_eeprom.h b/cores/arduino/stm32/stm32_eeprom.h index 56809a1634..75b373fc4c 100644 --- a/cores/arduino/stm32/stm32_eeprom.h +++ b/cores/arduino/stm32/stm32_eeprom.h @@ -48,8 +48,12 @@ /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ -#define FLASH_SECTOR_SIZE ((uint32_t)(16*1024)) //16kB page -#define E2END FLASH_SECTOR_SIZE + +#if defined (STM32F2xx) || defined (STM32F4xx) || defined (STM32F7xx) +//FLASH_SECTOR_SIZE +#define FLASH_PAGE_SIZE ((uint32_t)(16*1024)) //16kB page +#endif +#define E2END FLASH_PAGE_SIZE /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */