Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[Due] (I2C) Wire.endTransmission always returns non-zero. #1251
It looks like endTransmission returns the number of bytes sent from the transmit buffer, not an indication of success, as http://arduino.cc/en/Reference/WireEndTransmission suggests.
from \arduino-1.5.1r2\hardware\arduino\sam\system\libsam\source\twi.c :
The bug is in the lib or in the reference?
Unfortunately, the more you dig, the worse it gets.
It appears to me the devs at one point realized the work ahead of them was not trivial, and decided to supply a base-line functionality (below current standards). This is not a meant as a dig, just reality.
Any proc in the Wire library that accesses the I2C status register has been, or needs to be neutered (which is why I believe endTransmission got mangled in this version). Basically, any marginally serious I2C communication must bypass this version of the library, and twiddle the MCU registers directly.
Just scan the datasheet and look for bits that are "clear[ed] on read". This is totally not handled properly in 1.5.1r2.