# AT24Cxx::update vs AT24Cxx::write a question of speed?

**URL:** <https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350>\
**Category:** 3rd Party Boards\
**Created:** [July 13, 2025, 5:54am UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350 "2025-07-13T05:54:05Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![giovanniguerra](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/giovanniguerra/32/227267_2.png) [@giovanniguerra](https://forum.arduino.cc/u/giovanniguerra)\
**Post date:** [July 13, 2025, 5:54am UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/1 "2025-07-13T05:54:05Z")

</div>

Looking in the library for this EEPROM there is a `write()` function and an `update()` function.

The parameters are the same,` (uint16_t address, uint8_t value).`

It looks like the difference is that `update()` does not write anything if the data already contained in the EEPROM is already at the "new" value.

`write()` always writes.

Why not always use `update()`, the chip would last longer like that because it could have fewer writes?

Is it a question of speed? `write()` will be faster than update()....

Or have I misunderstood something?

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [July 13, 2025, 6:04am UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/2 "2025-07-13T06:04:51Z")

</div>

I don't think it is speed, I think that it's more a historical thing.

I think (but I don't know much about the history of the EEPROM library) that the library initially could only do read and write. And the user was doing the check if the value did change or not before writing.  
Later versions of the library took that pain away by providing the _update()_ function.

---

<div class="post-metadata">

**Author:** ![giovanniguerra](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/giovanniguerra/32/227267_2.png) [@giovanniguerra](https://forum.arduino.cc/u/giovanniguerra)\
**Post date:** [July 13, 2025, 6:09am UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/3 "2025-07-13T06:09:10Z")

</div>

But `update()` will be slower I presume?

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [July 13, 2025, 6:11am UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/4 "2025-07-13T06:11:21Z")

</div>

Yes. But it would also be slower if you were doing the checking yourself before writing.

Do you want a long life or a fast life 😉

---

<div class="post-metadata">

**Author:** ![giovanniguerra](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/giovanniguerra/32/227267_2.png) [@giovanniguerra](https://forum.arduino.cc/u/giovanniguerra)\
**Post date:** [July 13, 2025, 6:15am UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/5 "2025-07-13T06:15:34Z")

</div>

I want a long AND fast life!

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [July 13, 2025, 6:20am UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/6 "2025-07-13T06:20:27Z")

</div>

With `update()` and `write()` methods, you cannot achive "long AND fast life" of the EEPROM simultaneously.

---

<div class="post-metadata">

**Author:** ![giovanniguerra](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/giovanniguerra/32/227267_2.png) [@giovanniguerra](https://forum.arduino.cc/u/giovanniguerra)\
**Post date:** [July 13, 2025, 5:04pm UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/7 "2025-07-13T17:04:53Z")

</div>

I know, I was joking.

In my applications I don't need fast access, so I'll go with the long life option of `update()`.

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [July 13, 2025, 6:53pm UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/8 "2025-07-13T18:53:09Z")

</div>

I have no idea what you want to save in EEPROM but if it's anything different from a byte you should look at the _put_ and _get_ functions.

---

<div class="post-metadata">

**Author:** ![gilshultz](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gilshultz](https://forum.arduino.cc/u/gilshultz)\
**Post date:** [July 13, 2025, 6:59pm UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/9 "2025-07-13T18:59:34Z")

</div>

Surprise there is a part called FRAM (Ferroelectric Random Access Memory), not the oil filters. FRAM is a type of non-volatile memory that uses a ferroelectric layer to store data, allowing it to retain information even when power is lost. It offers advantages like faster write speeds and higher durability compared to traditional flash memory. It requires no delays when reading or writing to. It also allows single byte read/write, there is no such thing as sectors. The life cycle is in high the billions or more.

---

<div class="post-metadata">

**Author:** ![david\_2018](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/david_2018/32/1013044_2.png) [@david\_2018](https://forum.arduino.cc/u/david_2018)\
**Post date:** [July 13, 2025, 7:04pm UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/10 "2025-07-13T19:04:49Z")

</div>

> [@giovanniguerra](#):
>
> But `update()` will be slower I presume?

Not necessarily. Writing to the EEPROM is a fairly slow process, much slower than reading and comparing to see if the data has changed. If all the data you are writing has changed, then update() would be slower, but if there are portions that have not changed then update() would likely be faster.

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [July 14, 2025, 3:17am UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/11 "2025-07-14T03:17:48Z")

</div>

> [@david\_2018](#):
>
> Writing to the EEPROM is a fairly slow process,

Are you referring to ~3.4 ms write delay per byte?

```arduino
void setup()
{
  Serial.begin(9600);
  EEARL = 0x10; //EEPROM location: 0x0010
  EEARH = 0x00;
  //----------------
  EEDR = 0x15; //data to be written
  //------------------
  EECR &= (0 << EEPM1); //EEPROM programming Mode; Erase and Write
  EECR &= (0 << EEPM0);
  //--------------------
  EECR |= (1 << EEMPE); //Master Programming Bit is active
  EECR |= (1 << EEPE); //EEPROM programming is enabled
  //--------------------
  while (bitRead(EECR, EEPE) != LOW) //EEPE-bit remains HIGH until data write is not done
  {
    ; //wait until writing is done; about 3.4 ms later EEPE-bit goes from HIGH to LOW
  }
  //--------------
  EECR |= (1 <<EERE); //data read enabled
  byte n = EEDR; //n = 5
  Serial.print("Read from EEPROM Location, 0x0010: ");
  Serial.println(n);

  void loop() {} 
	

```

---

<div class="post-metadata">

**Author:** ![david\_2018](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/david_2018/32/1013044_2.png) [@david\_2018](https://forum.arduino.cc/u/david_2018)\
**Post date:** [July 14, 2025, 4:11am UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/12 "2025-07-14T04:11:48Z")

</div>

> [@GolamMostafa](#):
>
> Are you referring to ~3.4 ms write delay per byte?

Yes.

Gets a bit more complicated, now that I look at the data sheet. The AT24Cxx chips have a page-mode write, which is much faster than individually writing one byte at a time, but you do need to be aware of the page size for a particular memory chip.

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [July 14, 2025, 4:40am UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/13 "2025-07-14T04:40:49Z")

</div>

> [@david\_2018](#):
>
> The AT24Cxx chips have a page-mode write, which is much faster than individually writing one byte at a time,

You are correct for AT24XX EEPROM. AT24C32 supports 32-byte page size which can be written in a single ~5 ms write delay instead of 5x32 ms write delay that would be required if one goes by byte mode.

Does internal EEPROM of ATmega328P support page mode?

---

<div class="post-metadata">

**Author:** ![david\_2018](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/david_2018/32/1013044_2.png) [@david\_2018](https://forum.arduino.cc/u/david_2018)\
**Post date:** [July 14, 2025, 10:38am UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/14 "2025-07-14T10:38:40Z")

</div>

> [@GolamMostafa](#):
>
> Does internal EEPROM of ATmega328P support page mode?

Looks like it has a page size of 4 bytes, but page access is only available to an external programmer, all access from code is single byte.

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [July 14, 2025, 11:22am UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/15 "2025-07-14T11:22:50Z")

</div>

Would be glad to know if the page size information is in the datasheet.

---

<div class="post-metadata">

**Author:** ![david\_2018](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/david_2018/32/1013044_2.png) [@david\_2018](https://forum.arduino.cc/u/david_2018)\
**Post date:** [July 14, 2025, 11:29am UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/16 "2025-07-14T11:29:02Z")

</div>

It is, section 27.5 page size is given in a couple of tables. The entire section 27 concerns external programming.

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [July 14, 2025, 11:31am UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/17 "2025-07-14T11:31:21Z")

</div>

Thank you. I have got it.

 ![eepromPage](https://europe1.discourse-cdn.com/arduino/original/4X/8/8/2/882d6f5fdf5e8af2f6c222031f6ddf2dc676b073.png)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [January 10, 2026, 12:21pm UTC](https://forum.arduino.cc/t/at24cxx-update-vs-at24cxx-write-a-question-of-speed/1395350/19 "2026-01-10T12:21:58Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
