Hello,
I am reading/writing periodically to the I2C bus and have sometimes a problem with the master bit.
According to the manual "Before starting the next transaction in master mode, this bit must be confirmed to
be cleared."
Sometimes this bit is not cleared and my atempt to clear it will fail. I have then to reinit the I2C (reset bit).
The code for trying to clear the master bit at the beginning of the routine is like this:
to = I2C_TIMEOUT; //10
while (i2cREG1->MDR & I2C_MASTER) {
i2cREG1->MDR = I2C_MASTER | I2C_RESET_OUT | I2C_TRANSMITTER | I2C_STOP_COND;
delay_us(5);
to--;
if (!to) {busy = true; break; }
}
Do I miss something here? Why is the master bit not cleared from the previous transfer and even if so, how can I cleanly clear master mode to start anew (without doing a I2C reset)?
Thank you very much,
Tom