This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
Hello Team,
Skyler Baumer and Vamsi Gudivada
In the example code, a variable is used to track EEPROM empty or EEPROM has data but this approach fails because the variable is reinitialized on every boot.
How can I detect an empty EEPROM during runtime without relying on variables?
I want to implement:
• First boot: EEPROM empty, no data copied.
• Shutdown: RAM data stored into EEPROM.
• Next boot: Data read from EEPROM, copied into RAM.
void EEPROM_Read(uint16* Read_Buffer) { uint16 i; // I am expecting an api that can return the status of EEPROM and store it into Empty_EEPROM. if (Empty_EEPROM) { // Dont read EEPROM } 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++); } } }
Is there an API that returns an error code or the status of EEPROM (empty or non-empty) run time?
Hi Vikram,
There is no API that returns the status of EEPROM. You can add some logic to the EEPROM_Read() function that reads the status codes of the emulated EEPROM banks and pages to see if it is empty or not.
Kind regards,
Skyler