Looking for a simple bit-bang I2C slave code example

Hi guys,

I am currently looking into implementing a simple I2C slave on an MSP430M1232P. I am going to use the slave for testing an I2C bus that I implemented on another microcontroller. All I want the slave to do is send an acknowledge when the it is addressed and store a byte that is receives.

Since my version of the MSP has no I2C hardware I am trying to “bit-bang” it. It has turned out to be more complicated than I expected (I don’t really have much experience with the MSP430 series).

I have seen alot of examples for a masters, but no slaves. I also checked out TI’s site and had no luck (maybe I missed something…). So does anyone have a good bit-bang I2C slave example (C would be the best) that I could compile in Code Composer?

Thanks,

John H

I do not have the code, but I can help you to develop the code if you want.

I suggest that you make use of TimerA3. To do this, the I2C clock should connect to TACLK (i.e., P1.0). The I2C data should connect to TA0, TA1, or TA2 (i.e., P1.1, P2.2, P1.2, P2.3, or P1.3). With this hardware assist, the timing will be more accurate, and the code will be easier to write.