On Mon, 03 Apr 2023 20:55:43 +0200, Bo Berglund via fpc-pascal >On Mon, 3 Apr
2023 14:26:17 -0400, "Jeffrey A. Wormsley via fpc-pascal"
><fpc-pascal@lists.freepascal.org> wrote:
>
>>I've been using i2c and SPI eeproms for almost two decades.  All of them
>>can read/write a single byte if that's what you want to do, but the
>>write/erase restrictions I noted are there for any parts I've ever used.
>>If you write a byte to $00, you cannot write it to $01 without first
>>erasing the entire block that it is located in (usually 128 to 256 bytes).
>>You can write $FF to $F0, then $F0 to $80, then $80 to $00, as these all
>>only involve turning 1 bits into 0 bits, but if you try to write from a $00
>>to a $01, then it will not work, at least not on any part I've ever used,
>>as that involves turning a 0 bit into a 1 bit.   All of the parts I've
>>seen, if you want to modify a single memory location (if the write involves
>>turning a 0 bit into a 1 bit), they require you to read the block of data
>>into your CPU, modify it there, erase the block, then write the entire
>>block data back into the chip.  I've seen some parts that have an on-chip
>>RAM buffer that would let you read the block into this RAM buffer with one
>>command, modify the RAM buffer with a single byte write, erase the block,
>>then write the RAM buffer back to the chip, which is a lot faster than
>>having to do this yourself with your CPU memory, but it still required the
>>block erase and that block erase still counted towards your maximum number
>>of erase cycles.  I have not seen a chip that allowed completely random
>>writes at the byte level before short of a static ram with battery backup.
>>
>>If you have an i2c part that doesn't work like this, then I would be very
>>interested in knowing the part number and seeing a link to the data sheet.
>>Such a part would make using these sorts of devices much easier, but to
>>date I have never seen one.
>>
>>Jeff
>>
>I just tested by writing four 0x00 bytes in a row, then verifying that the
>memory read shows these, then writing other data and again verifying that the
>data is there.
>
>All using the i2c-tools commands:
>
>$ i2ctransfer -y 1 w6@0x50 0x00 0x00 0x00 0x00 0x00 0x00
>$ i2ctransfer -y 1 w2@0x50 0x00 0x00 r8@0x50
>0x00 0x00 0x00 0x00 0xff 0xff 0xff 0xff
>
>$ i2ctransfer -y 1 w6@0x50 0x00 0x00 0x70 0x30 0x55 0x40
>$ i2ctransfer -y 1 w2@0x50 0x00 0x00 r8@0x50
>0x70 0x30 0x55 0x40 0xff 0xff 0xff 0xff
>
>The part number is: CAT24C32 by ON Semiconductor (www.onsemi.com)
>It is a 128 kbit (16 kbyte) part organized as 64 pages of 256 bytes.

Sorry copied from the wrong datasheet here, should be CAT24C128


-- 
Bo Berglund
Developer in Sweden

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to