Pages: [1]   Go Down
Author Topic: I2C Slave Repeated Start transactions are broken.  (Read 2051 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I believe the following commit:
https://github.com/arduino/Arduino/commit/7392f8514de9d68659c744fb956c089f7b3932ef#libraries/Wire

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.

Thanks,
Tom

Logged

Pages: [1]   Go Up
Jump to: