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