Showing results for 
Search instead for 
Did you mean: 

I2C Problem / timeout

Posted on April 06, 2011 at 15:53

I2C Problem / timeout

John F.
Posted on May 17, 2011 at 14:30

I think AN2824 will help you.

Posted on May 17, 2011 at 14:30


1). your timeout is too short

2). you get no ACK from EEPROM after ADDR has been sent (power supply for EEPROM is unstable)

3). your timeout runs out because the loop is interrupted (any interrupts activated?)

4). I would compare as

    if ( SystemTicks >= TimeOut) ...

P.S. look for AN3281 on ST site.

Associate II
Posted on May 17, 2011 at 14:30


When you write in EEPROM you must write by packet in accordance with Page size and for read operation you can read all the contents of EERPOM in one operation.

i.e:Page size of 24C64  EEPROM is 32byte, you must proceed as follow to write 50 bytes from address 0x000F:

      1- Write in address 0x000F 17bytes. (32 - 15)

      2- Wait until EEPROM is ready for another operation ( in write operation EEPROM take time to actually write bytes in memory).You can code a function that implement this sequence:

                                  1- generate start

                                  2- Send EEPROM Address

                                  3- if Nack received redo (1) and (2). if ACK received exit this function and start new operation (read or write).

There is a new Library called CPAL it's a high layer driver for I2C IP. In CPAL package there are examples developped to work with 24C64 EEPROM.

link :