SPRADL4 January 2025 F29H850TU , F29H859TU-Q1
The EEPROM_Read() function provides functionality for reading the most recently written data and storing it into a temporary buffer. This function can be used for debug purposes or to read stored data at runtime. The behavior differs in Page Mode vs 64-bit mode. In general, the most recently written data (page or 64-bits) are stored in the Read_Buffer.
First, the function verifies that data has been written to EEPROM by checking the Empty_EEPROM flag. If attempting to read data before any has been written, the values read into the buffer are invalid and an error is thrown.
if (Empty_EEPROM)
{
Sample_Error();
}
Page Mode: If data has been written, the current EEPROM Bank and Page are found and then the Read Buffer is filled.
EEPROM_GetValidBank(1);
Page_Pointer += WRITE_SIZE_BYTES*2;
uint32_t i;
for (i = 0; i < DATA_SIZE; i++)
{
Read_Buffer[i] = *(Page_Pointer++);
}
64-Bit Mode: The pointer is moved back by eight addresses (64 bits total) and the Read Buffer is filled with the data.
Bank_Pointer -= WRITE_SIZE_BYTES;
uint32 i;
for (i = 0; i < WRITE_SIZE_BYTES; i++)
{
Read_Buffer[i] = *(Bank_Pointer++);
}