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.

CCS/TMS320F28027: No SCL in I2C Module?

Part Number: TMS320F28027


Tool/software: Code Composer Studio

Hi everyone,

I am using I2C to connect to a slave (MCP9808) that has the following timing diagram:

I have a bunch of questions concerning I2C Module in TMS320F28027:

1/ Does setting I2caRegs.I2CSAR = 0x18; means that  i shouldn't send the slave address only the register address and MCU will do that automatically!! and does the slave respond with 2 ACK (1 for slave address and 1 for register address)?

2/ Why i can't see the frequancy of SCL after setting up the clock ? even if the transmitting and receiveing isn't done at least i should see the SCL clock, right !?

//============================================= configuring the I2C module clocks.

   I2caRegs.I2CMDR.bit.IRS = 0; //put the I2C module to reset state to config clocks

   I2caRegs.I2CPSC.all = 5;//setting IPSC to 5 results in a module clock of 10 MHz (module clock = CPU clock / (IPSC + 1))

   //The master clock
   //Tmod * (ICCH + d) and Tmod * (ICCL + d) formulas respectively, where Tmod = 1/module clock, and d = 5
   //both high-time and low-time to be 12.5 us, resulting in 25 us periodic time, equivalent to 40 kHz I2C frequency
   I2caRegs.I2CCLKL = 10;//120;
   I2caRegs.I2CCLKH = 5; //120;
   //I2caRegs.I2CMDR.bit.MST = 1; //resets after each stop condition
   I2caRegs.I2CMDR.bit.IRS = 1;//put the I2C module out of reset state

3/  In the eeprom example i got the following signal in SCL, is it suppose to be like this !?

Thank you,

Regards,

  • hi Younes ,

    1. Yes. Once the I2CSAR is configured it would be taken care by the module to send the slave address during the communication.

    2. what is the initial system clock freq ?

    3. I will check this

    Regards.
  • Thanks Meghana for the reply,

    1. Once the I2CSAR is configured the communication won't start until I2caRegs.I2CMDR.bit.STT is set to one, right!? also should i check for the ACK of sensor after I2CSAR is configured before sending the register address?

    2. Initial system clock frequancy is 60MHz and my sensor's SCL can hundle up to 400KHz.
    Does the clock appears on SCL after setting I2caRegs.I2CMDR.bit.MST!? according to TMS320F2802x Piccolo Technical Reference Manual page 523: "The master clock appears on the SCL pin when the I2C module is configured to be a master on the I2C bus."

    Is there a clock in SCL when it is idle!? i mean after a stop bit!

    3. i wasn't using any eeprom there, i just wanted to see the SCL clock and that was the output.


    Regards,
  • Hi Younes,

    1. You are right, You will not see the clock on the SCL pin unless there is a transfer initiated by setting the start bit( I2caRegs.I2CMDR.bit.STT). Regarding the ACK, yes you should check for the ACK or NACK from the sensor before proceeding to transfer. This information is available in the I2CSTR(Status) register.

    2. Clock appears on the SCL only on initiating a transfer. There will be no clock on the SCL pin when the module is idle.

    3. Clock seems just right, However the shape of the clock is dependent on the pullup resistor used for the I2C bus. If the pullup resistor is weak compared to the bus capacitance, the time taken for the I2C bus top settle to 1 will be slow. You can create a strong pull(by decreasing the pull resistor value) to get a better clock shape.

    Regards,
    Praveen