0

I'm currently designing a battery operated device that has to write data to an EEPROM before shutting down, or in regular intervals to save data. Would it damage the EEPROM if it had to shut down while it is being written to?

The first possible case is when it is transmitting the data over I2C. That shouldn't affect it much. But if it gets powered down while it is actually writing the byte to its memory, I don't know whether it would save it correctly or corrupt it.

  • Well I beleive the EEPROM writes are going to happen with a single full byte at a time. So if you are writing single bytes they will either happen or not happen depending on when power is pulled. If you are recording a float(4 bytes) and power is removed half way through, then if you try and read data back out it will be corrupt. Without knowing the data you are trying to save, or how the device is being used, I cant really give you more advice then that. – Chad G Mar 2 '18 at 17:13
  • Each byte is independent, it's like a snapshot of the current state of the Arduino. – DaniFoldi Mar 2 '18 at 17:17
  • Then I do not believe you will run into an issue with corrupting a single byte, but the problem you may actually be facing is how to know when to save the data. You dont want to write too often as you can eventually wear out the EEPROM, but you want to make sure it gets saved on power down ya? – Chad G Mar 2 '18 at 17:19
  • @ChadG That is correct. I have a slave ATTiny85 that does the power-down through a mosfet. – DaniFoldi Mar 2 '18 at 17:20
  • 1
    So the 85 is what is controlling the power to the main board(uno or something)? Then it can have a pin that tells the main board "im about to shut you down" and data can be saved at that time. – Chad G Mar 2 '18 at 17:23
2

According to the datasheet, an EEPROM write takes 3.3mS. If power drops below the level needed to complete the write, the data will be corrupted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.