How can I reset the internal address counter in Giantec GT24C64A EEPROM?

43 Views Asked by At

I'm trying to read from eeprom by using i2cgert (or i2ctransfer) but i can't reset the internal address counter of the eeprom. Hence, I each time read different values for the same offset.
For example:

$ i2ctransfer -y 0 w1@0x52 0x00 r20@0x52
0x00 0x00 0x00 0x40 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x20 0x00 0x00 0x00  

$ i2ctransfer -y 0 w1@0x52 0x00 r20@0x52
0x05 0x00 0x00 0x20 0x00 0x00 0x00 0x30 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

can you please help me with how i can read with i2ctransfer or i2cget and to make sure that i starting to read from the beginning of the eeprom?

1

There are 1 best solutions below

0
Dražen Grašovec On

I dont know the internals of i2ctransfer although I used it for reading SFP 512 Byte EEPROM and it worked.

Your syntax looks legit, although you dont need chip address specify again:

i2ctransfer 0 w1@0x52 0x0 r20

this is from DS, how to set the random address first:

5.10.2 Random Address Read Selective Read operations allow the Master device to select at random any memory location for a Read operation. The Master device first performs a 'dummy' Write operation by sending the Start condition, Slave address and byte address of the location it wishes to read. After the GT24C64A acknowledges the byte address, the Master device resends the Start condition and the Slave address, this time with the R/W bit set to one. The EEPROM then responds with its ACK and sends the data requested. The Master device does not send an ACK but will generate a Stop condition. (Refer to Figure 5-9. Random Address Read Diagram.)

Did you try 2 separate transfers? First write dummy byte (set address counter to 0) and then sequential read of 20 bytes.