Search the Community
Showing results for tags 'i2c bus collision'.
Found 1 result
-
We have been using Andrew Smallridge's I2C driver with great success for a long time, but now something is up and I can't explain it. Maybe someone here can. The new design is using I2C(1) as a slave and I2C(2) as a master (on a secondary I2C bus). The chip is the 18F46K22. Problem summary: Master I2C init fails with PIR3.SSP2IF == 0 and PIR3.BCL2IF == 1. Andrew's I2C init code calls 12c_stop as the last instruction. The stop function asserts SSPCON2.PEN to initiate the stop condition, and then gets stuck in an infinite loop waiting for PIR3.SSP2IF to assert. It never does, but I notice that a bus collision is detected. The only other devices on that secondary I2C bus are two MCP23017 I/O expanders. I can't see how a bus collision can be possible. As an experiment, I try initializing I2C(1) as a master and it works fine. The bus is actually not even connected to anything, and the pull-ups are off-board. The board build is very good: checked for solder bridges, cold solder joints, and any other possible shorting conditions. We are really scratching our heads over this. Any diagnostic suggestions would be very welcome. -Mark Guzewski PS: For reference purposes, here are the definitions that I'm using for Andrew's I2C code template. I have checked these a thousand times and I'm convinced it's OK. #define PORTD_ 0xf83 #define TRISD_ 0xf95 #define e_ClkBit 0 #define e_DataBit 1 #define e_SSPCON1 0xf6c #define e_SSPCON2 0xf6b #define e_SSPSTAT 0xf6d #define e_SmpBit 7 #define e_SSPADD 0xf6e #define e_SSPBUF 0xf6f #define e_SSPIF_PIR 0xfa4 #define e_BCLIF_PIR 0xfa4 #define e_SspifBit 7 #define e_BclifBit 6