2015-10-09 04:14 AM
Hi,
I cannot write any data into the eeprom after a Erase_page. HAL_FLASH_Program(..) and FLASH_Erase_Page(...) work fine independently. But if HAL_FLASH_Program(...) is called just after FLASH_Erase_Page(), HAL_FLASH_Program is not working. The data written are always 0x00. Despite a 10 ms delay after the FLASH_Erase_Page, it is not working. Thanks.2015-10-09 04:31 AM
You shouldn't just wait for x milliseconds, you should wait until the busy flag is cleared from the FLASH_SR register, then check for the error flags, if everything is OK only then process to the next operation with the EEPROM.
What library are you using? HAL, Snippets?2015-10-09 04:47 AM
I am using HAL library. The HAL_FLASH_Program implements an instruction to wait for last operation to be completed.
2015-10-09 04:51 AM
Then why are you using HAL_FLASH_Program(..) and FLASH_Erase_Page(..) function to porgram the EEPROM? Shouldn't you use the EEPROM functions. I'm not using HAL but here are the functions I could find related to the EEPROM:
HAL_FLASHEx_DATAEEPROM_Unlock HAL_FLASHEx_DATAEEPROM_Lock HAL_FLASHEx_DATAEEPROM_Erase HAL_FLASHEx_DATAEEPROM_Program ..and some others..2015-10-09 05:04 AM
you're right!
Indeed ,these functions work fine! Thank you very much.