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.

Little explanation for the i2c eeprom example

Other Parts Discussed in Thread: TMS320F28035

Someone can help me to understand this example on a TMS320F28035 ?

Ok, when I launch it no problem everyting works.

But I don't really understand WHERE the data is written...

Indeed, in the I2cMsgOut1 struct I have two adresses : I2C_EEPROM_HIGH_ADDR and I2C_EEPROM_LOW_ADDR (0x00 & 0x30) then I have two data to write (0x12 & 0x34)

then in the "I2CA_WriteData" function I can see this code who write the data on the I2C bus :

I2caRegs.I2CDXR = msg->MemoryHighAddr;
I2caRegs.I2CDXR = msg->MemoryLowAddr;
// for (i=0; i<msg->NumOfBytes-2; i++)
for (i=0; i<msg->NumOfBytes; i++)

{
      I2caRegs.I2CDXR = *(msg->MsgBuffer+i);
}

So if I understand the datas send on the I2C bus are  => I2C_ADDR 0x00 0x30 0x12 0x34 ? I'm right ?

So where are stored my datas ? is Adresse 0x00 ==0x12 and 0x30 ==0x34 ? OR adresse 0x30 ==0x12 and 0x31 == 0x34 ??

Thank you.

Best regards, Nicolas

  • Nicolas,

    The data is stored in MsgBuffer[i] with i ranging from 0 to I2C_MAX_BUFFER_SIZE.

    If you watch I2cMsgIn1.MsgBuffer[i] and I2cMsgOut1.MsgBuffer[i] in the Expression watch window, you will see the values.

    -Chuck

  • Hi Nicalos,
    It saves in address 0x0030 and 0x0031, this is correct until only your eeprom requires 2 bytes for address.
    ex : 1)24LC16B requires only 1 address byte with above program whatever you send will go to default 0x00 and so on.
    2)24LC32 requires only 2 address byte with above program whatever you send will go to default 0x0030 and so on.

    Regards
    LT