AnsweredAssumed Answered

SPC56 I2C - stop bit and bus idle condition

Question asked by casas.fabien on Mar 11, 2015
Latest reply on Sep 7, 2017 by Erwan Y

I'm developing an I2C driver for a SPC560B54L5 micro, and I have problems generating the stop bit.

At the end of a write operation, I run the following pseudo code:

   while  (0 == IBSR. IBIF) { /* wait */ }
   IBCR.MSSL = 0 /* generate stop bit */
   while (1 == IBSR.IBB) { /* wait */ }

After a few successful transfers (including the stop condition and return to idle), the driver gets stuck while waiting for the IBB bit to return to 0.
I monitored the SDA and SCL signals: some times the Stop condition is not generated, and some other times the Stop is generated but IBB does not drop. 

The I2C is run in Master mode, and interrupts are disabled.

Also, when I run the driver in step-by-step debug, the problem appears after a few frames are sent (including Stop condition and return to idle).
The problem appears on the first frame when I run the driver without stopping the CPU.

Could you please help me find why the stop condition is not generated or not detected?

Best regards,