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.

TMS320F28388D: I2C in Free Data Format mode sends address anyway

Part Number: TMS320F28388D

I've found a strange behaviour when i set I2C in Free Data Format .

Actually I want to write each byte and read each byte by myself, a complete control on I2C .

To accomplish this you can see this code:

Init

I2caRegs.I2CMDR.all &= ~(0x20U);
I2caRegs.I2CPSC.all = 0xB;        // Prescaler - need 7-12 Mhz on module clk
I2caRegs.I2CCLKL = 0x7;          // NOTE: must be non zero
I2caRegs.I2CCLKH = 0x8;           // NOTE: must be non zero
I2caRegs.I2CMDR.bit.MST = 0x1;
I2caRegs.I2CMDR.bit.TRX = 0x1;
I2caRegs.I2CCNT = I2C_NUMBYTES;
I2caRegs.I2CMDR.bit.BC = 0x0U;
I2caRegs.I2COAR.all = I2C_OwnAddress;      // Own address
I2caRegs.I2CSAR.all = I2CSlave_Address;      // Slave address
I2caRegs.I2CMDR.bit.FREE = 0x1;
I2caRegs.I2CSTR.all = 0xFFFF;
I2caRegs.I2CIER.all = 0x08;
I2caRegs.I2CMDR.all |= 0x0020;

Write DevAddress + 1b AddHI + 1bAddLO

I2caRegs.I2CSAR.all = 0x00;      // Slave address NOT USED
I2caRegs.I2CMDR.bit.MST = 0x1;
I2caRegs.I2CMDR.bit.TRX = 0x1;
I2caRegs.I2CMDR.bit.FDF = 0x1;
I2caRegs.I2CMDR.bit.NACKMOD = 0x0;
I2caRegs.I2CMDR.bit.STB = 0x0;

I2caRegs.I2CCNT = 3;            // DevAdd + 2bytes Address
I2caRegs.I2CMDR.bit.STT = 0x1;

I2caRegs.I2CDXR.all= 0xA0;
while(I2caRegs.I2CSTR.bit.BYTESENT != 0x1);
I2caRegs.I2CSTR.bit.BYTESENT = 0x1;

I2caRegs.I2CDXR.all= 0x00;
while(I2caRegs.I2CSTR.bit.BYTESENT != 0x1);
I2caRegs.I2CSTR.bit.BYTESENT = 0x1;

I2caRegs.I2CDXR.all= 0x01;
while(I2caRegs.I2CSTR.bit.BYTESENT != 0x1);
I2caRegs.I2CSTR.bit.BYTESENT = 0x1;

/*
I2caRegs.I2CMDR.bit.STP = 0x1;
while(I2caRegs.I2CMDR.bit.STP != 0x0);
I2caRegs.I2CSTR.bit.BYTESENT = 0x1;
*/

// HERE'S THE PROBLEM
//When I set next register SST I see that address inside I2caRegs.I2CSAR.all
//is sent on I2C , since I'm in FREE DATA FORMAT this should not happen
I2caRegs.I2CMDR.bit.STT = 0x1;  // SEND START CONDITION TO READ

I2caRegs.I2CCNT = 1;

I2caRegs.I2CDXR.all= 0xA1;
while(I2caRegs.I2CSTR.bit.BYTESENT != 0x1);
I2caRegs.I2CSTR.bit.BYTESENT = 0x1;

I2caRegs.I2CSAR.all = 0x00;
I2caRegs.I2CCNT = 5;
I2caRegs.I2CMDR.bit.TRX = 0x0;

count = 0;
while(count < 5)
{
    if(I2caRegs.I2CSTR.bit.RRDY ==0x1)
    {
        I2C_RXdata[count] = I2caRegs.I2CDRR.all;
        count++;
    }
}

I2caRegs.I2CMDR.bit.STP = 0x1;
while(I2caRegs.I2CMDR.bit.STP != 0x0);

I2caRegs.I2CSTR.bit.BYTESENT = 0x1;

I manually:

Set ByteCounter to 3 -> Set START CONDITION -> Send DevAdd -> Send AddHI + Send AddLOW -> 

SET START CONDITION (HERE'S ERROR) -> Send DevAdd (R) -> Ask for n bytes

When I set the second StartCondition after address write, automatically I2C peripheral sends my registered slave address inside peripheral register (in this case 0x00) . This is an error since I must send this device address manually by application.

Here's what I see:

Why this is happening? What is wrong?