2010-12-04 12:57 PM
I2C BitBang ??
2011-05-17 05:17 AM
The I2C protocol is fairly well documented, and reasonably simple to implement.
You basically have to define your clock/data signals on GPIO pins in open collector/drain mode, and shift out your address and data, and wait for slave acknowledgements, or data. The most difficult part would be to get some reasonable timing delays, but the clocking of I2C is not particularly critical (most parts will work for DC to several hundred KHz, and any variation between). Most I2C bus routines can be sufficiently abstracted that the EEPROM access code can live on top of native HW I2C implementations or GPIO bit-bang implementations. If this is difficult to understand, you really need to review the I2C protocol some more, and look at how GPIO pins are configured and controlled on the STM32. The biggest problem with I2C is that it is pretty dumb, and peripherals don't reset when you reset the CPU, or the I2C HW. If they get stuck in weird states, they must be clocked out.