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.

TMS320F28335: I2C questions

Hi, 

1. In many codes in InitI2C is setup Clock Divider Registers :

I2caRegs.I2CCLKL = 10;
I2caRegs.I2CCLKH = 5;

Why is 10 and 5? How to calculate it and select the appropriate settings? 

2. I am ready to communicate i2c, in main() is for example 

I2C_Write(0x70, Register_2D, 0x0E);
I2C_Read(0x70, Register_2D);
I2C_Read(0x13, Register_X0);

and when i use debug mode with break point and execution of a program step by step is all ok, but if the program works without break point it i2c stops  on the step

while(I2caRegs.I2CMDR.bit.STP == 1); or while (I2caRegs.I2CSTR.bit.BB == 1);  

I think that it happens so, because program works too fast, but I have no idea how to fix it. Which parameter is responsible for that?  I thought to set interrupt with timer between I2C_Write and I2C_Read, but it is not good solution, 

Thanks for help 

  • Using a longer SCL low time gives slave devices more time to respond. You can find general guidelines for I2C bit timing configuration in the F28335 I2C User's Guide:

    Are you waiting for each transaction to complete before you start the next one? If STP or BB are stuck low, it implies that the slave is holding SCL low.