Author Topic: I2C EEPROM partial page write behaviour  (Read 3727 times)

0 Members and 1 Guest are viewing this topic.

Offline HwAoRrDkTopic starter

  • Super Contributor
  • ***
  • Posts: 1937
  • Country: gb
I2C EEPROM partial page write behaviour
« on: August 18, 2023, 10:31:58 am »
Can anyone illuminate me with regard to the behaviour of I2C EEPROMs (e.g. 24C32) when doing page writes? Specifically, with regard to partial page writes.

What I'm not clear on after having read the datasheets of EEPROMs from multiple vendors, is what happens in the following scenario:

1. A write operation is initiated by sending the slave address and 16-bit ROM address to be written to, but this address is part-way into a page.
2. Multiple data bytes to be written are subsequently sent, a number equal to fill the remainder of the page.
3. The EEPROM writes the page upon termination of the I2C transaction (i.e. at STOP condition).

What gets written to the beginning of the page? We didn't provide any data to be written there. Is it wiped? Does it retain its previous values?

Or is this one of those "just don't do that" things? :)
 

Offline Dave

  • Super Contributor
  • ***
  • Posts: 1376
  • Country: si
  • I like to measure things.
Re: I2C EEPROM partial page write behaviour
« Reply #1 on: August 18, 2023, 11:00:49 am »
The data at the beginning of the page is going to be retained. You can definitely make partial page writes, just keep in mind that when you write to a page, all the memory cells of the page are going to accumulate wear cycles, regardless of whether data in them is changed or not.

Edit: Crossed out the incorrect claim.
« Last Edit: August 19, 2023, 10:27:18 pm by Dave »
<fellbuendel> it's arduino, you're not supposed to know anything about what you're doing
<fellbuendel> if you knew, you wouldn't be using it
 

Offline eneuro

  • Super Contributor
  • ***
  • Posts: 1562
  • Country: 00
Re: I2C EEPROM partial page write behaviour
« Reply #2 on: August 18, 2023, 07:49:09 pm »
Or is this one of those "just don't do that" things? :)
24C32  ???
Quote
Obsolete Device Please use 24LC32A or 24LC65.
:-DD


12oV4dWZCAia7vXBzQzBF9wAt1U3JWZkpk
“Let the future tell the truth, and evaluate each one according to his work and accomplishments. The present is theirs; the future, for which I have really worked, is mine”  - Nikola Tesla
-||-|-
 

Offline Perkele

  • Regular Contributor
  • *
  • Posts: 78
  • Country: ie
Re: I2C EEPROM partial page write behaviour
« Reply #3 on: August 18, 2023, 08:29:46 pm »
Isn't there also "byte" addressing mode, where the address is not defined by a page number, but by "word" address?
For those EEPROMs, word size is 1 byte.
The address is sent as two bytes after the I2C address.
 

Offline HwAoRrDkTopic starter

  • Super Contributor
  • ***
  • Posts: 1937
  • Country: gb
Re: I2C EEPROM partial page write behaviour
« Reply #4 on: August 19, 2023, 08:54:11 am »
24C32  ???
Quote
Obsolete Device Please use 24LC32A or 24LC65.
:-DD

:palm: ::)

I was using "24C32" as shorthand for the wider contemporary range of devices, not that specific part number. You know, things like AT24C32, CAT24C32, M24C32, etc.
 

Offline HwAoRrDkTopic starter

  • Super Contributor
  • ***
  • Posts: 1937
  • Country: gb
Re: I2C EEPROM partial page write behaviour
« Reply #5 on: August 19, 2023, 08:56:26 am »
Isn't there also "byte" addressing mode, where the address is not defined by a page number, but by "word" address?
For those EEPROMs, word size is 1 byte.
The address is sent as two bytes after the I2C address.

Yes, I know. But that's not what my question was about.
 

Offline HwAoRrDkTopic starter

  • Super Contributor
  • ***
  • Posts: 1937
  • Country: gb
Re: I2C EEPROM partial page write behaviour
« Reply #6 on: August 19, 2023, 09:05:05 am »
The data at the beginning of the page is going to be retained. You can definitely make partial page writes, just keep in mind that when you write to a page, all the memory cells of the page are going to accumulate wear cycles, regardless of whether data in them is changed or not.

How does that work, though? The datasheets imply that there's some kind of buffer that the received data bytes go into (with excess bytes wrapping to the beginning), then the content of the buffer is written upon end of transaction. That would mean that the buffer has to be pre-populated with the current values from the EEPROM page, surely?
 

Offline Shonky

  • Frequent Contributor
  • **
  • Posts: 298
  • Country: au
Re: I2C EEPROM partial page write behaviour
« Reply #7 on: August 19, 2023, 09:20:33 am »
EEPROM can be written byte by byte. The pages are just to allow the host to load a bunch of bytes at once to program.

It's not a page like flash where a whole page needs to be erased before writing in which case you would need to read the existing data that's not to be changed.
 

Offline Dave

  • Super Contributor
  • ***
  • Posts: 1376
  • Country: si
  • I like to measure things.
Re: I2C EEPROM partial page write behaviour
« Reply #8 on: August 19, 2023, 10:43:31 pm »
The data at the beginning of the page is going to be retained. You can definitely make partial page writes, just keep in mind that when you write to a page, all the memory cells of the page are going to accumulate wear cycles, regardless of whether data in them is changed or not.
How does that work, though? The datasheets imply that there's some kind of buffer that the received data bytes go into (with excess bytes wrapping to the beginning), then the content of the buffer is written upon end of transaction. That would mean that the buffer has to be pre-populated with the current values from the EEPROM page, surely?
Disregard the last sentence in my post - it's incorrect.
Flash memory is erased page by page, whereas EEPROM can be erased byte by byte, as Shonky said.
<fellbuendel> it's arduino, you're not supposed to know anything about what you're doing
<fellbuendel> if you knew, you wouldn't be using it
 

Offline eneuro

  • Super Contributor
  • ***
  • Posts: 1562
  • Country: 00
Re: I2C EEPROM partial page write behaviour
« Reply #9 on: August 20, 2023, 12:07:15 am »
I was using "24C32" as shorthand for the wider contemporary range of devices, not that specific part number.
Choose one device (eg. 24LC65) and look into its datasheet  :palm:
As simple as it is eg.: 24LC65 
8-Byte Page, or Byte modes Available ...
Voltage Operating Range: 1.8V to 6.0V ...
12oV4dWZCAia7vXBzQzBF9wAt1U3JWZkpk
“Let the future tell the truth, and evaluate each one according to his work and accomplishments. The present is theirs; the future, for which I have really worked, is mine”  - Nikola Tesla
-||-|-
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->