1.3.1 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:
- Disable the Start and Stop conditions interrupt functions.
- Enable the I2C module.
- Wait 250 ns + six instruction cycles (FOSC/4).
- Clear the Start and Stop conditions interrupt flags.
- 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
A0 | A1 | A2 | A3 | A5 | |||
X | X | X | X | X |