SPRADL4 January 2025 F29H850TU , F29H859TU-Q1
The EEPROM_UpdatePageData() function provides functionality for updating the EEPROM page data. This function is called from the EEPROM_Write_Page() function.
The data from the write buffer is written to flash 64-bits at a time, with the offset being computed each loop iteration.
uint32_t i, Page_Offset;
for(i = 0; i < EEPROM_PAGE_DATA_SIZE / WRITE_SIZE_BYTES; i++)
{
Page_Offset = WRITE_SIZE_BYTES*2 + (WRITE_SIZE_BYTES*i);
EEPROM_Write_Buffer(Page_Pointer + Page_Offset, Write_Buffer + (i*WRITE_SIZE_BYTES));
}
If the programming is successful, the page is marked as current and the Empty_EEPROM flag is cleared. The code is shown below:
Fill_Buffer(Page_Status, status_buffer_len, CURRENT_PAGE);
EEPROM_Write_Buffer(Page_Pointer, Page_Status);
Empty_EEPROM = 0;
After a successful write, the function checks if the inactive EEPROM unit needs to be erased. If so, it erases the unit and clears the flag.
if (Erase_Inactive_Unit)
{
EEPROM_Erase_Inactive_Unit();
Erase_Inactive_Unit = 0;
}