The I2C Start and/or Stop Flags May Be Set When I2C Is Enabled

When I2C is enabled, erroneous Start and/or Stop conditions may be detected. This can generate erroneous I2C interrupts if enabled.

Work around

Use the following procedure to correctly detect the Start and Stop conditions:

  1. 1.Disable the Start and Stop conditions interrupt functions.
  2. 2.Enable the I2C module.
  3. 3.Wait 250 ns + six instructions cycles (FOSC/4).
  4. 4.Clear the Start and Stop conditions interrupt flags.
  5. 5.Enable the Start and Stop conditions interrupt functions if used.
SSPxCON3bits.SCIE = 0;          // Disable Start condition interrupt
SSPxCON3bits.PCIE = 0;          // Disable Stop condition interrupt
SSPxCON1bits.SSPEN = 1;         // Enable I2C
Delay();                        // Wait for 250 ns + 6 instruction cycles (FOSC/4)
PIRxbits.SSPxIF = 0;            // Clear the MSSP interrupt flag
SSPxCON3bits.SCIE = 1;          // Enable Start condition interrupt if used 
SSPxCON3bits.PCIE = 1;          // Enable Stop condition interrupt if used 

Affected Silicon Revisions

A3 A5 A6 A7 A8      
X X X X X