nimaltd / ee

EEPROM emulation for stm32.
GNU General Public License v3.0
336 stars 75 forks source link

STM32F103 ee_format clears 0'th page #16

Closed remrol closed 2 years ago

remrol commented 2 years ago

On STM32F1 architecture _EE_PAGE_OR_SECTOR is PAGE, then ee_format instruction: flashErase.PageAddress = _EE_USE_FLASH_PAGE_OR_SECTOR; wrongly assigns page number instead of page address and leads to clearing 0'th bank. Corrected line should be: flashErase.PageAddress = _EE_ADDR_INUSE;

nimaltd commented 2 years ago

do you check it? I think I checked before and it works fine.... I can not remember now

remrol commented 2 years ago

Yes this is the problem which I found just now on STM32F103CBT6 using STM32CubeIDE Version: 1.10.1 HAL 1.8.4 Original code overwrites first FLASH page and the MCU stops working, need to re-program MCU. After modification everything works fine. Of course it will be great if someone check this issue.

EDIT: from stm32f1xx_hal_flash_ex.h, see PageAddress desription, it clearly says it should be FLASH address

/**

} FLASH_EraseInitTypeDef;

nimaltd commented 2 years ago

thanks for reporting..

nimaltd commented 2 years ago

please check again. I fixed it

remrol commented 2 years ago

Works fine thank you, can be closed