When I2C is enabled, erroneous Start and/or Stop conditions may be detected. This can generate erroneous I2C interrupts if enabled.
Use the following procedure to correctly detect the Start and Stop conditions:
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
A3 | A5 | A6 | A7 | A8 | |||
X | X | X | X | X |