How to recover from I2C bus collision BCLIF?
This Errata needs to be added to PIC18F25K20 Errata.
PIC18F2455/2550/4455/4550 Rev. A3 Silicon Errata
17 Module: MSSP
It has been observed that following a Power-on Reset, I2C mode may not initialize properly by just configuring the SCL and SDA pins as either inputs or outputs. This has only been seen in a few unique system environments.
A test of a statistically significant sample of preproduction systems, across the voltage and current range of the application's power supply, should indicate if a system is susceptible to this issue.
Work around
Before configuring the module for I2C operation:
- Configure the SCL and SDA pins as outputs by clearing their corresponding TRIS bits.
- Force SCL and SDA low by clearing the corresponding LAT bits.
- While keeping the LAT bits clear, configure SCL and SDA as inputs by setting their TRIS bits.
Once this is done, use the SSPCON1 and SSPCON2 registers to configure the proper I2C mode as before.
This same bug seems to ocur on PIC18F26K20/SS (Revision B3) too, also needs to be added to it's errata.
I don't know your specifics but I ran into a problem once where the microcontroller was coming out of reset way early (much before Vdd stabilized on the I2C bus). So the uController started to read / write data before the target could function properly causing all sort of I2C operational issues.