Arduino Forum

Development => Suggestions for the Arduino Project => Topic started by: wallclimber21 on Apr 08, 2011, 02:52 am

Title: I2C Slave Repeated Start transactions are broken.
Post by: wallclimber21 on Apr 08, 2011, 02:52 am

I believe the following commit:

has broken I2C Slave Repeated Start transactions.

In particular, when the master sends a Start - Write - Repeated Start - Read - Stop, the Wire library doesn't create an even for the Read transaction.

It turns out that the twi_stop function has the following term in its write to TWCR: | _BV(TWSTO)

According to the ATmega128 datasheet, TWSTO should ONLY be used for master transactions, not for slave transaction.

I created a new version that adds a twi_stop_slv function that removes this particular term and also removes the wait for stop while function that follows it.

After this fix, everything is fine again.

This should be fixed.