1.3.2 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. Disable the Start and Stop conditions interrupt functions.
  2. Enable the I2C module.
  3. Wait 250 ns + six instruction cycles (FOSC/4).
  4. Clear the Start and Stop conditions interrupt flags.
  5. Enable the Start and Stop conditions interrupt functions if used.
I2CxPIEbits.SCIE = 0;        // Disable Start conditoin interrupt
I2CxPIEbits.PCIE = 0;        // Disable Stop condition interrupt
I2CxCON0bits.EN = 1;         // Enable I2C
Delay();                     // Wait for 250 ns + 6 instruction cycles (FOSC/4)
I2CxPIRbits.SCIF = 0;        // Clear the Start condition interrupt flags
I2CxPIRbits.PCIF = 0;        // Clear the Stop condition interrupt flags
I2CxPIEbits.SCIE = 1;        // Enable Start condition interrupt if used 
I2CxPIEbits.PCIE = 1;        // Enable Stop condition interrupt if used 

Affected Silicon Revisions

B0 B2B3F1G1
X X X X