add eeprom feature v2

This commit is contained in:
2022-12-15 15:04:05 +01:00
parent f654257dd8
commit ed6b7160de
6 changed files with 14 additions and 14 deletions

View File

@ -41,8 +41,8 @@
*/
/* Configuration of eeprom emulation in flash, can be custom */
#define START_PAGE_ADDRESS 0x0801F000U /*!< Start address of the second last page in flash, for EEPROM emulation */
#define CYCLES_NUMBER 1U /*!< Number of 10Kcycles requested, minimum 1 for 10Kcycles (default), for instance 10 to reach 100Kcycles. This factor will increase pages number */
#define START_PAGE_ADDRESS 0x0801E000U /*!< Start address of the second last page in flash, for EEPROM emulation */
#define CYCLES_NUMBER 2U /*!< Number of 10Kcycles requested, minimum 1 for 10Kcycles (default), for instance 10 to reach 100Kcycles. This factor will increase pages number */
#define GUARD_PAGES_NUMBER 0U /*!< Number of guard pages avoiding frequent transfers (must be multiple of 2): 0,2,4.. */
/* Configuration of crc calculation for eeprom emulation in flash */

View File

@ -50,6 +50,9 @@ static uint32_t GetBankNumber(uint32_t Address);
*/
HAL_StatusTypeDef FI_WriteDoubleWord(uint32_t Address, uint64_t Data)
{
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_PROGERR | FLASH_FLAG_WRPERR |
FLASH_FLAG_PGAERR | FLASH_FLAG_SIZERR | FLASH_FLAG_PGSERR | FLASH_FLAG_MISERR | FLASH_FLAG_FASTERR |
FLASH_FLAG_RDERR | FLASH_FLAG_OPTVERR); // clear all Flags before write (USER modification)
return HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, Address, Data);
}