Hot!Read Write in 24AA025E64 EEPROM

Author
amol09
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2018/08/27 04:50:46
  • Location: 0
  • Status: offline
2018/08/28 00:04:15 (permalink)
0

Read Write in 24AA025E64 EEPROM

Hi,
We are trying to read and write the eeprom 24AA025E64. We are using the TI's Processor as Master.
For the read and write operations, as per TI's framework, we have to provide  slave address of the eeprom and data buffer.
 
The data buffer should contain page address (16 bytes) on first 2 bytes followed by data to be written (16 bytes or less) (as 16 bytes is the page size). So a buffer of total 18 bytes is required for every page write operation. We first write the page address and then write the data using the data buffer as specified above for every write operation. If we do not have the page address in the data buffer, the write operation fails.
When we read a similar process is followed, first we write the page address to be read, then provide a empty data buffer to read operation. We are able to read the page, but only first 15 bytes are read properly, the 16 th byte of the page is some garbage value.
 
If we write data less than 16 bytes, the data read is proper. The issue is seen only on the 16th byte of the page.
 
Also if we write data more the 16 bytes,  the data wraps around on the same page.
So, if we manually separate the data into first 16 bytes an then the remaining bytes, to do 2 write operation on consecutive pages, the write on second operation is done on the page for first write of 16 bytes i.e. data wraps around on the same page instead of writing on the next page even when the address of the next page is specified during the second write operation. (Note :- single write operation has two parts, first the page address and then data in buffer with page address as specified above).
 
We do not specify the start or stop condition, it is taken care by the I2C.
The same logic of read and write is working fine with other eeprom on the same hardware.
 
1] Can you help us with the issues specified above?
2] Could you please send us some sample code for read and write operations on 24AA025E64 for different page numbers and with different data ?
3] What is the exact full size of the 24AA025E64 and its page size ?
 
Regards,
Amol
#1

13 Replies Related Threads

    Mysil
    Super Member
    • Total Posts : 2885
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: Read Write in 24AA025E64 EEPROM 2018/08/28 04:59:12 (permalink)
    4 (2)
    Hi,
    Seem that there may be a mistake in page alignment calculations in your code.
     
    Be aware that in C language, and in Hardware addressing, counting start from 0, and not from 1.
    Thus page addressing will be bytes with address from 0 to 15 (inclusive) in the same page,
    address 16 is in the next page!
    Similarly, address 256 go together with 271
     
    You may check manually or by program: divide the address by 16 using integer division.
    If result is the same, addresses belong in the same page. If result is different, then these addresses belong to different pages.
    Example: 271 / 16 = 16;   272 / 16 = 17; Addresses 271 and 272 belong in different pages.
     
        Mysil
    #2
    amol09
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/08/27 04:50:46
    • Location: 0
    • Status: offline
    Re: Read Write in 24AA025E64 EEPROM 2018/08/28 22:09:49 (permalink)
    0
    Hi Mysil,
     
    We are calculating the address for the page by dividing the number of bytes by 16. (same as you are suggesting).
     
    Also, the 16th byte from my previous post meant the last byte of the page ( i.e. the 15 th index, page starting from the 0th index addressing). And still we are not able read the last byte of the page properly.
     
    Writing data more than the page size, we are observing the data wrap around condition. Could you also please help with this issue ?
     
    Regards,
    Amol
    #3
    qhb
    Superb Member
    • Total Posts : 7151
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: online
    Re: Read Write in 24AA025E64 EEPROM 2018/08/28 22:38:37 (permalink)
    4.33 (3)
    That chip only uses a single byte for page selection, so you may be sending one more byte than required...
     

    Worst forum problems are now fixed, but the damn firewall is still there.
    #4
    amol09
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/08/27 04:50:46
    • Location: 0
    • Status: offline
    Re: Read Write in 24AA025E64 EEPROM 2018/08/30 02:53:58 (permalink)
    0
    Hi,
     
    Thank you for the reply.
    Writing one byte page address solved the issue of data wrap around and we are able to write the data into different pages.
     
    We are still having an issue.
    When we write data bytes equal to page size i.e. 16 bytes, and read the same page, we get only the first 15 bytes and the last byte of page is not read. And if we write data more than 16 bytes ( 16 bytes in one page and rest in the consecutive page ), we get the last byte of the first page(where the first 16 bytes are written) properly.
     
    Could you let us know what could be the possible issue ?
     
    Regards,
    Amol
    #5
    Mysil
    Super Member
    • Total Posts : 2885
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: Read Write in 24AA025E64 EEPROM 2018/08/30 09:12:34 (permalink)
    0
    Hi,
    Hardware in the EEPROM is Not able  to Write in two different pages in the same transfer!
    Writing more than 16 data bytes in one transfer ( in addition to I2C address aka. control byte, and memory address) make no sense.
    There is only 16 RAM bytes available for temporary storage of Data to be written into a single EEPROM page.
     
    To store more than one EEPROM page, you must make code to write 16 data bytes at a time, send I2C Stop signal and wait for EEPROM write cycle to complete. Before writing the next 16 bytes.
     
    See description of how the device work in datasheet.
     
        Mysil
    #6
    amol09
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/08/27 04:50:46
    • Location: 0
    • Status: offline
    Re: Read Write in 24AA025E64 EEPROM 2018/08/30 22:20:28 (permalink)
    0
    Hello Mysil,
     
    Thank you for your reply.
    We have referred the datasheet, and we have the complete process for the data to write in page in our code.
     
    Also, as mentioned in my previous post that we separate the data bytes (if more than page size) and write it in different pages.
    We have API present in the framework which can write page of 16 bytes in one transfer.(Which has the start bit, page address, data bytes , stop bit and then the wait for EEPROM write cycle ). So, we use this API to write different pages after dividing the data bytes to be written(if the data bytes to be written are more than page size).
     
    Even after this, we observe that last byte of the page (i.e 15th considering the page has index 0 to 15 (16 bytes)) is not been written in the page.
    For eg.
    Page number :- 6
    Data to be written :- ABCDEFGHIJKLMNOP
    delay(100 msec)
    Data read form page number 6 :- ABCDEFGHIJKLMNO
     
    Similar is observed on multiple page write. If we write 3 consecutive pages, last byte of all the 3 pages is not written.
    Could you please suggest something on this issue ?
     
    Regards,
    Amol
    #7
    amol09
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/08/27 04:50:46
    • Location: 0
    • Status: offline
    Re: Read Write in 24AA025E64 EEPROM 2018/08/30 23:12:42 (permalink)
    0
    Hi,
     
    I have another doubt.
    As per datasheet, in section 6.2, in the note, it is mentioned :-
    Physical page boundaries start at addresses that are integer multiples of the page buffer size (or ‘page size’) and end at addresses that are integer multiples of [page size – 1].
     
    So, in this case, actual number of data bytes written on the page will be 15 bytes as the end address of page would be multiple of [ page size - 1] i.e [16 - 1] = 15.
     
    Is this understanding correct ? Could you please confirm.
     
    Regards,
    Amol
    #8
    Mysil
    Super Member
    • Total Posts : 2885
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: Read Write in 24AA025E64 EEPROM 2018/08/30 23:47:55 (permalink)
    0
    Hi,
    A possible workaround is to write 8 bytes, half a page, at a time.
    There is no need to wait 100 ms, write cycle time is 5 millisecond maximum.
     
    Make a Oscilloscope, or Logic Analyzer recording of communication on SCL and SDA signal lines,
    preferably with a DSO instrument able to record a complete 18 byte transfer,
    and with serial analysis if possible.
     
    The other possibility is to show the source code you are using, including header files declarations and settings.
    Since you are not using a PIC processor to run master code, also description or link to documentation of any library code beeing called.
     
        Mysil
    #9
    qhb
    Superb Member
    • Total Posts : 7151
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: online
    Re: Read Write in 24AA025E64 EEPROM 2018/08/30 23:52:53 (permalink)
    0
    amol09
    So, in this case, actual number of data bytes written on the page will be 15 bytes as the end address of page would be multiple of [ page size - 1] i.e [16 - 1] = 15.
     
    Is this understanding correct ? Could you please confirm.

    No, because the start address is 0.
     

    Worst forum problems are now fixed, but the damn firewall is still there.
    #10
    amol09
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/08/27 04:50:46
    • Location: 0
    • Status: offline
    Re: Read Write in 24AA025E64 EEPROM 2018/08/31 02:43:00 (permalink)
    0
    Hi Mysil,
     
    Thank you for the reply.
    I tried the workaround you suggested. And now we are able to write the data.
    Our issue is resolved.
     
    Thank you for the support.
     
    Regards,
    Amol
    #11
    amol09
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/08/27 04:50:46
    • Location: 0
    • Status: offline
    Re: Read Write in 24AA025E64 EEPROM 2018/08/31 02:49:53 (permalink)
    0
    Hi qhb,
     
    As you posted the start address is 0, i agree with it for the first page.
     
    If we calculated the page start and end address for 2nd page it would be
    start address for 2nd page  (multiple of page size ) :- 16
    end address for 2nd page (multiple of [page size -1] ) :- 2 * (16 - 1) :- 2 * 15 :- 30.
     
    So as per this calculations, page size comes to be 15 bytes.
    Could you please elaborate ?
     
    Regards,
    Amol
     
    #12
    qhb
    Superb Member
    • Total Posts : 7151
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: online
    Re: Read Write in 24AA025E64 EEPROM 2018/08/31 03:00:12 (permalink)
    0
    The brackets are misplaced in that note.
    It should be
    [multiple of page size] -1
    Pages are all 16 bytes, so just use some common sense.

    Worst forum problems are now fixed, but the damn firewall is still there.
    #13
    amol09
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/08/27 04:50:46
    • Location: 0
    • Status: offline
    Re: Read Write in 24AA025E64 EEPROM 2018/08/31 03:28:27 (permalink)
    0
    Hello qhb,
     
    Thank you for the support. Our issue is resolved.
     
    Regards,
    Amol
    #14
    Jump to:
    © 2018 APG vNext Commercial Version 4.5