SPRADE8A November 2023 – April 2024 F29H850TU , F29H859TU-Q1 , TMS320F28P650DH , TMS320F28P650DK , TMS320F28P650SH , TMS320F28P650SK , TMS320F28P659DH-Q1 , TMS320F28P659DK-Q1 , TMS320F28P659SH-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.
Page Mode: 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 data has been written, the current EEPROM Bank and Page are found and then the Read Buffer is filled.
uint16 i;
// Check for empty EEPROM
if (Empty_EEPROM)
{
Sample_Error(); // Attempting to read data that hasn't been written
} else
{
// Find Current Bank and Current Page
EEPROM_GetValidBank(1);
// Increment page pointer to point at first data word
Page_Pointer += 8;
// Transfer contents of Current Page to Read Buffer
for(i=0;i<DATA_SIZE;i++)
{
Read_Buffer[i] = *(Page_Pointer++);
}
}
64-Bit Mode: 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 data has been written,The pointer is moved back by four addresses (64-bits total) and the Read Buffer is filled with the data.
uint16 i;
// Check for empty EEPROM
if (Empty_EEPROM)
{
Sample_Error(); // Attempting to read data that hasn't been written
} else
{
// Move the bank pointer backwards to read data
Bank_Pointer -= 4;
// Transfer contents of Current Page to Read Buffer
for(i=0;i<4;i++)
{
Read_Buffer[i] = *(Bank_Pointer++);
}
}