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.

TMS320F2800155-Q1: C2000 microcontrollers forum

Part Number: TMS320F2800155-Q1
Other Parts Discussed in Thread: SYSCONFIG, C2000WARE

Dear team:

    When I use the routine i2c_ex6_eeprom_interrupt.c, when reading data, set the number of bytes to be read to 0, then my clock line SCL and data line SDA will remain low. After I simulate the reset again, clock line SCL will remain low while data line will remain high. At this time, the IIC bus locks and is stuck in the I2CBusScan(I2CA_BASE,pAvailableI2C_targets) while(! (I2C_getStatus(base) & I2C_STS_REG_ACCESS_RDY)); Here, I have tried to pull down SCL to keep 2ms when configuring the bus, which seems to be unable to exit the bus lock state, I have queried other processing methods on the TI forum, as follows: When I use the routine i2c_ex6_eeprom_interrupt.c, when reading data, set the number of bytes to be read to 0, then my clock line SCL and data line SDA will remain low. After I simulate the reset again, clock line SCL will remain low while data line will remain high. At this time, the IIC bus locks and is stuck in the I2CBusScan(I2CA_BASE,pAvailableI2C_targets) while(! (I2C_getStatus(base) & I2C_STS_REG_ACCESS_RDY)); Here, I have tried to pull down SCL to keep 2ms when configuring the bus, which seems to be unable to exit the bus lock state, I have queried other processing methods on the TI forum, as follows:

void I2CDeadLock(void)
{
   // uint8_t states;
    I2C_disableReset(I2CA_BASE);//IICMDR.ISR = 0
    DEVICE_DELAY_US(2000u);
    I2C_setConfig(I2CA_BASE, I2C_CONTROLLER_SEND_MODE);
    I2C_sendNACK(I2CA_BASE);//IICMDR. == 0
    I2C_enableFdF(I2CA_BASE); //IICMDR.FDF = 1
    I2C_enableLoopback(I2CA_BASE);//IICMDR.DLF = 1
    I2C_setDataCount(I2CA_BASE, 1);//ICCINT.ICCINT = 1
    I2C_putData(I2CA_BASE,0xFF);
    I2C_sendStartCondition(I2CA_BASE);
    DEVICE_DELAY_US(2000u);
  //  while(!(I2C_getStatus(I2CA_BASE) & I2C_STS_REG_ACCESS_RDY));


   I2C_enableReset(I2CA_BASE);//IICMDR.ISR = 1
    I2C_setConfig(I2CA_BASE, I2C_CONTROLLER_SEND_MODE);
    I2C_enableFdF(I2CA_BASE); //IICMDR.FDF = 1
    I2C_setDataCount(I2CA_BASE, 1);//ICCINT = 1
    I2C_putData(I2CA_BASE,0x01);
    I2C_sendStartCondition(I2CA_BASE);
    while(!(I2C_getStatus(I2CA_BASE) & I2C_STS_REG_ACCESS_RDY));
    I2C_sendNACK(I2CA_BASE);

    I2C_sendStopCondition(I2CA_BASE);
}

With the above code, SDA and SCL can be released, but this will cause my IIC communication to be abnormal.

And when SCL, SDA has been at low power level, this time has been handling interrupt i2cFIFO_isr (), will cause my program to run other. To sum up, one is how do I exit when I am in a deadlock state, and the other is how do I operate when SCL and SDA are still on power,

Best Regards

Zhang

  • Hi Zhang,

    After the reset, what is the status of the busy bit and can you specify how the I2C communication is abnormal?

    I would keep line 14 commented out, and after a reset, when I2C receives/transmits a STOP bit, this bit should be cleared. When the SDA goes from high-> low, that should initiate the start condition. Another idea is to try adding some time after the I2C is brought out of reset such as suggested in this E2E: TMS320F280049: i2c configuration

    Other E2Es that could be helpful: TMS320f2808 I2C problem, TMS320F28027F: I2C scan not blocking

    Best,

    Aishwarya

  • Hi Aishwarya Rajesh,

    First of all, thank you very much for responding to my question

    After the reset,SCL is always low and SDA is always high,This will cause my communication to be abnormal.

    At the same time, when I frequently write and read data in EE, I find that the operation will not communicate normally, and at this time my I2caRegs.CMDR.STP is always 1, I would like to ask why this situation is caused,

  • Zhang,

    Double check the I2C clock, power, and pinmux configurations. How this should be done is shown in any of the I2C examples (Example #1 uses SysConfig to do so). If you haven't already, I would recommend using C2000Ware 5.02 (latest version) that has some enhancements to the I2C SysConfig. 

    Do you have pull up resistors on the SDA and SCL? I2C is an open drain bus and everything on the bus is pulling low or going high-impedance. To pull up the lines high, an external pull up is required as internal pull ups are too weak. We typically recommend around 2.2kOhms and this information is in the I2C TRM section and this App Note. Once that is configured, what is the level of these two lines when the MCU is in reset (high impendence outputs)? If SCL is still low, a different pull-up is needed and/or the issue could be with the target.

    Aishwarya

  • Zhang,

    Have you been able to resolve this issue? If there are no more questions, I will go ahead and close this thread  

    Best Regards,

    Aishwarya