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 Read Problem

Part Number: TMS320F28035

Hello C200 experts.

I have a custom slave device with the same MCU. I have written both slave and master code myself. My problem is when try to read data from slave buffers first elements are different than expected data. My expected data is 11-21-31 but here is the picture of the situation.

  • Hi Frozen,

    You're expecting elements 0, 1, and 2 to match that data?

    You'll likely need to debug the master and slave code together in CCS, using breakpoints and such. Maybe the slave device TX buffer isn't being filled for the first transmissions back to the master.

    Best,

    Kevin

  • Kevin Allen18 said:

    Hi Frozen,

    You're expecting elements 0, 1, and 2 to match that data?

    You'll likely need to debug the master and slave code together in CCS, using breakpoints and such. Maybe the slave device TX buffer isn't being filled for the first transmissions back to the master.

    Best,

    Kevin

    Yes the buffers elements should match with my data. 

            case I2C_TX_ISRC:   // =5
    
                I2caRegs.I2CDXR = *I2C_s.I2CSlave_TransmitField;
                I2C_s.I2CSlave_TransmitField++;
                StopCpuTimer0();        //No timeout, so stop the timer
                ReloadCpuTimer0();      //Reload the period value (35 ms timeout)
    
                break;

    TransmitField is the one contains my data to be send. I am confused cant find the problem.

  • Hi Frozen,

    Are you using FIFO mode? Can you put a breakpoint in your slave code at the line below and see if it is filling with 11 for the first transmissions.

    I2caRegs.I2CDXR = *I2C_s.I2CSlave_TransmitField;

    How is the master device receiving the data and storing it? Can you provide that code snippet?

    Best,

    Kevin