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.

TMS320F28035: I2C EEPROM Sample Code

Part Number: TMS320F28035

Hi Friends,

I'm working with I2C EEPROM (AT24C04), for that I've imported sample code from control-suit.

Sample code works fine only if I write 2 or 4 bytes of data and again read back from EEPROM,

but as I change followings;

#define I2C_MAX_BUFFER_SIZE       6//2

#define I2C_NUMBYTES                     8 //4

MsgBuffer [ I2C_NUMBYTES ] with 6 bytes of data

Reading from EEPROM address register can't be executed. 

FYI: I've observed into watch window that Register Ready Access Interrupt Flag is not generated, I didn't modify the sample code, except for the above mention 2 lines and buffer of 6 bytes

  • Chinmay,

    The max FIFO size of the F28035 I2C is only 4 words deep. If you want to send additional data to the EEPROM and then read it back you will need to manipulate the I2CA_Writedata function to properly write a number of words greater than the FIFO depth. one way might be to add a check on the TX FIFO status before writing the next word to the FIFO to ensure it has room. Similar changes will need to be done for the receive side.

    Regards,

    Mark

  • Hi Mark,

    Thanks for the reply. 

    Yes, I'd already made those changes in I2CA_Writedata & ReadData Functions as mentioned below:

    in I2CA_WriteData function; 

    while (I2caRegs.I2CSTR.bit.XRDY == 0) { }; // added in before send

    similarly, I2CA_ReadData function contrains; 

    while (I2caRegs.I2CSTR.bit.XRDY == 0) { }; // for address setup part 

    Is there any sample code for continuous read of register?

    Apart from ti sample programs from control-suit, Is there any other samples available?

  • Chinmay,

    These are all the example code for I2C that we currently have.

    You will need to write some way to check the current status of the transfer along with the number of words total to be transmitted. i.e. write the first two bytes, then wait until there is room to write additional data to the FIFO to continue the transfer. The example is a pretty simple state machine. Perhaps another state is needed for the continuous transfer step?

    Regards,
    Mark