-
-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Due] (I2C) Wire.endTransmission always returns non-zero. #1251
Comments
I also just tested the return value of endTransmission, and it definitely has a bug. I tried sending 5 bytes over I2C, and it returned the number 5. This is only supposed to return a value of 0 - 4. |
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. |
does not work in 1.5.2... |
Any news on this topic? I'm totally stuck in getting a PCA9622 Led driver to work over i2c... The Arduino gets stuck in the endTransmission function. |
The return code has been addressed by @bluesign2k's commit e079baa and is already in master. |
1.5.1r2
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 text was updated successfully, but these errors were encountered: