Skip to content

Commit 21985ca

Browse files
authored
Merge pull request #49 from fpistm/issue47_EEPROM
Fix #47 eeprom issue
2 parents 7244e6c + e49849b commit 21985ca

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

cores/arduino/stm32/stm32_eeprom.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ void set_data_to_flash(void)
180180
EraseInitStruct.Page = FLASH_PAGE_NUMBER;
181181
#else // STM32F4xx
182182
EraseInitStruct.PageAddress = FLASH_BASE_ADDRESS;
183-
EraseInitStruct.NbPages = 1;
184183
#endif
184+
EraseInitStruct.NbPages = 1;
185185

186186
if(HAL_FLASH_Unlock() == HAL_OK) {
187187
#ifdef STM32L0xx

cores/arduino/stm32/stm32_eeprom.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,12 @@
4848

4949
/* Exported types ------------------------------------------------------------*/
5050
/* Exported constants --------------------------------------------------------*/
51-
#define FLASH_SECTOR_SIZE ((uint32_t)(16*1024)) //16kB page
52-
#define E2END FLASH_SECTOR_SIZE
51+
52+
#if defined (STM32F2xx) || defined (STM32F4xx) || defined (STM32F7xx)
53+
//FLASH_SECTOR_SIZE
54+
#define FLASH_PAGE_SIZE ((uint32_t)(16*1024)) //16kB page
55+
#endif
56+
#define E2END FLASH_PAGE_SIZE
5357

5458
/* Exported macro ------------------------------------------------------------*/
5559
/* Exported functions ------------------------------------------------------- */

0 commit comments

Comments
 (0)