This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

F28335 I2C Interface with EEPROM

Hi

I am facing problem on I2C interface (F28335) with EEPROM (AT24C1024B).

I was intialized slave address register by the salve address.The I2CCNT register intialized by 3.After that  i am trying to transmitt 3 bytes to the slave device  in Master Transmitter mode.After transmission of the 3 bytes the BB bit will goes to zero as per theory.But in my case it is not resetting to zero,it shows always one.

I am getting Register Access ready interrupt continuously.May i know what it is?

How can i know the slave is receiveing data from the master,is there any flags or interrupts,how can i know the communication establishment between master and slave?

For write operation i need to send two bytes of EEPROM memory addresses and one byte of data,for Read operation i has to send two bytes of address to the EEPROM and then  i has to read the data from the EEPROM.

What i am doing wrong in my intializations,please send the check list to fix this problem.

It is very urjent to me,please help in this regard.

Thanks

Srinivas reddy

  • It seems like you don't send the STOP bit. Show us the code.

  • Hi Bartosz,

    Thanks for your quick response.

    First my intializations are shown below.

    void Init_I2C_A  (void)

    {

     I2caRegs.I2CSAR  = 0x00A0;          //Slave Address,In my case it is A0

    I2caRegs.I2CPSC.all  = 14;

    I2caRegs.I2CCLKL  =  5;

    I2caRegs.I2CCLKH  = 5;

    I2caRegs.I2CIER.all  = 0x24;

    I2caRegs.I2CMDR.all  = 0x0020;

    I2caRegs.I2CFFTX.all  = 0x4001;

    I2caRegs.I2CFFTX.all  = 0x2041;

    }

    My Write function is shown below.

    void   I2C_Write  (unsigned int Addr,unsigned char Data)

    {
     I2caRegs.I2CSAR   =  0xA0;

    while(I2caRegs.I2CSTR.bit.BB  ! =  0) ;  //Waiting for BB is set to Zero.

    I2caRegs.I2CCNT   =  0x03  ;  //Below 3bytes i want to transmit to EEPROM

    I2caRegs.I2CDXR = 0x00  ; First Byte

    I2caRegs.I2CDXR = 0x001 ; Second Byte

    I2caRegs.I2CDXR = 0x02  ; Third Byte

    I2caRegs.I2CMDR.all = 0x2E20  //Master/Transmitter

    }

    Read Process is:

    void read ( unsigned int Addr)

    {
    I2caRegs.I2CSAR   =  0xA0;

    while(I2caRegs.I2CSTR.bit.BB  ! =  0) ;  //Waiting for BB is set to Zero.

    I2caRegs.I2CCNT   =  0x02  ;  //Below 2bytes i want to transmit to EEPROM

    I2caRegs.I2CDXR = 0x00  ; First Byte

    I2caRegs.I2CDXR = 0x001 ; Second Byte

    I2caRegs.I2CMDR.all = 0x2620  //Master/Transmitter

    I2caRegs.I2CCNT   =  0x01  ;  //1byte i want to receive from  EEPROM

    I2caRegs.I2CMDR.all = 0x2C20  //Master/Receiver

    //Receive Data

    }

    These routines i wrote for EEPROM interfacing.

    What can i do to send a stop command to master?Is there anything wrong in my intializations ,write and Read functions.If  there please let me know,it is very helpfull to me go ahead.

    Thanks

    Srinivasulu Reddy

    srinivas@wisdomtech.co.in

  • In your initialization routine:

    (...)

    I2caRegs.I2CFFTX.all  = 0x4001;

    I2caRegs.I2CFFTX.all  = 0x2041;

    }
    What's this? The second line was intended for receive FIFO register?

  • Yes it is for Receive FIFO,

    In the last post i did a spelling mistake.Actually it is  for I2CFFRX

    Thanks

  • Hi Bartosz

    What i am doing wrong in my process.Please help in this regard.

    Thanks

  • Hai

    Please fix my problem on I2C interface.I am stuck up at that problem.

     

    Thanks

  • Srinivasulu Reddy said:

    Hi

    I am facing problem on I2C interface (F28335) with EEPROM (AT24C1024B).

    I was intialized slave address register by the salve address.The I2CCNT register intialized by 3.After that  i am trying to transmitt 3 bytes to the slave device  in Master Transmitter mode.After transmission of the 3 bytes the BB bit will goes to zero as per theory.But in my case it is not resetting to zero,it shows always one.

    I am getting Register Access ready interrupt continuously.May i know what it is?

    How can i know the slave is receiveing data from the master,is there any flags or interrupts,how can i know the communication establishment between master and slave?

    For write operation i need to send two bytes of EEPROM memory addresses and one byte of data,for Read operation i has to send two bytes of address to the EEPROM and then  i has to read the data from the EEPROM.

    What i am doing wrong in my intializations,please send the check list to fix this problem.

    It is very urjent to me,please help in this regard.

    Thanks

    Srinivas reddy

    are monitoring the SDA and SCL lines on the scope?

    if the BB bit is not reset that means the communication is not complete.(stop bit has not been recieved by the device.)

    monitor your SCL line after one time communication. the slave  may pull it low. thus no clk will be present.

    if that's the case then in your I2C initialization code put a I2C reset condtion as the starting statement.

    and then execute the code. Also if you have any ESTOP0 statement in the code then it may aslo result in undesirable output as you may halt the communication in between the data transfer.

    do repeated write and read operations and monitor SCL and SDA

  • Hi everyone,

          It seems like y'all are doing a good job of debugging this as it is. The F28335 Peripheral Explorer Kit has example software that shows how to use the I2C port on the F28335, you might want to take a look at that software, as it is available for free at www.ti.com/c2000tools.

    Charlie