does an eeprom get erased for every read?

Hey all,
I just bought an DS3121 RTC module which comes with an AT24c32 eeprom. When i was searching for its arduino libraries with eeprom support, I came across this:

The author says that the eeprom can be read only once and gets erased after every read.

Can anybody explain why is it so?

Thanks in advance :smiley:

Where does the author say that?
If he said it, he's wrong - unless he wrote the library to do that, in which case don't use it.

Pete

Sorry, it was not the eeprom. The author said that his function readLogfrom allows the user to read only once. It was mentioned in his sample program "MultiDataLogger".

Found this in his library file. He clears the eeprom space using makeEEPROMspace routine after reading the log. Wonder why..

uint16_t nextReadAddress = readLogFrom(eepromReadAddress, timestamp, data, size);

  if(nextReadAddress == EEPROM_BYTES+1) 
  {    
    // Indicates no log entry was read (0 start byte) 
    return 0;
  }
      
  // Was read OK so we need to kill that byte, we won't trust the user to have
  // given the correct size here, instead read the start byte
  makeEEPROMSpace(eepromReadAddress, (readEEPROMByte(eepromReadAddress)>>5)+5);
  
  eepromReadAddress = nextReadAddress;
  return 1;
}

That snippet is useless and unless you are prepared to provide an exact quote from the author and links to exactly what it is you’re talking about, I’m not prepared to hunt down MultiDataLogger or anything else.

Pete

Hey pete,

I am extremely sorry for that careless response. Thought that snippet would help you to narrow down what exactly I was trying to implement. My apologies!

Here are the exact links:

  1. The sample program multiDatalogger:
    DS3231_Simple/MultiDataLogger.ino at master · sleemanj/DS3231_Simple · GitHub

The author mentions that the data logged data can be read only once. I believe it is because of the calling makeEEPROMspace in the end of readLog routine, which you can find it in the below file.

  1. The library DS3231_simple library .cpp file:
    DS3231_Simple/DS3231_Simple.cpp at master · sleemanj/DS3231_Simple · GitHub

The author mentions that the data logged data can be read only once

No he doesn't. Not in that link. I've wasted enough time looking for this mythical statement.

Pete

I am sorry for the trouble, but it is mentioned before the dumpLog function as a comment in that program.

Here it is:

void dumpLog()
{
  MyLogDataStructure loggedData;
  DateTime     loggedTime;
  
  // Note that reading a log entry also deletes the log entry
  // so you only get one-shot at reading it, if you want to do
  // something with it, do it before you discard it!

  unsigned int x = 0;
  while(Clock.readLog(loggedTime,loggedData))
  {
    if(x == 0)
    {
      Serial.println();
      Serial.println(F("Date,analogRead(A1),Temperature"));
    }
    
    x++;
    Clock.printTo(Serial,loggedTime);
    Serial.print(',');
    Serial.print(loggedData.analogReadValue);
    Serial.print(',');
    Serial.println(loggedData.temperatureValue);
  }
  Serial.println();
  Serial.print(F("# Of Log Entries Found: "));
  Serial.println(x);
  Serial.println();
}
Contact GitHub

The author says that the eeprom can be read only once and gets erased after every read.

Well, no, that's not what he said.
He was talking about a log entry that is generated by his library. It's nothing to do with the functionality of an EEPROM. You can read an EEPROM any number of times.
But for whatever reason, he has written the logging of data in his library so that if you use readLog to read a log entry, it is deleted. His choice. But I can find no explanation.

Pete