Skip to content
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

Wire.endTransmission(); freezes if connection gets lost #5249

Closed
holgerlembke opened this issue Aug 14, 2016 · 2 comments
Closed

Wire.endTransmission(); freezes if connection gets lost #5249

holgerlembke opened this issue Aug 14, 2016 · 2 comments
Assignees
Labels
Library: Wire The Wire Arduino library Type: Duplicate Another item already exists for this topic

Comments

@holgerlembke
Copy link

Wire.endTransmission(); freezes, when connection somehow gets lost. A simple cable issue might let endTransmission() do its while() loops in twi_writeTo and twi_readFrom eternally.

There is no easy way an end user can detect this situation, avoid this situation or react to this situation.

As far as I read from the forums this is a lengly discussed issue. Following the discussions there already is a patch:

http://forum.arduino.cc/index.php?topic=344506.msg2374342

Could we please move it into current code base? Thanks.

@facchinm facchinm added the Library: Wire The Wire Arduino library label Aug 22, 2016
@facchinm facchinm self-assigned this Aug 22, 2016
@facchinm
Copy link
Member

Duplicate of #1476 , following the conversation there

@ermtl
Copy link

ermtl commented Mar 27, 2020

It's been 9 [expletive deleted] YEARS since that bug was first discussed (2011), countless people pulled their hair trying to understand why their Arduino was freezing, why would it work normally, then suddenly stop, a dozen of times, it's been raised in here, dozens of times people had been told to get lost, use something else, etc ...
#7328
#2418
#1842
#5249
arduino/ArduinoCore-avr#42
Google shows pages after pages of people getting started and who get discouraged by this elusive bug they don't understand. This runs totally contrary of what arduino is supposed to stand for.

If the fix was difficult, if it compromised compatibility or added other problem, it would be understandable, but it's not the case, all that [expletive deleted] is caused by those 2 damn lines of code that obviously can create an infinite loop if for some reason the read operation does not complete :

// wait for read operation to complete
while(TWI_MRX == twi_state){
continue;
}

Yes, I know, this state is not supposed to happen according to the I2C protocol, but guess what ? electrical glitches didn't get the memo.

Countless people, after losing hours or days kind of solved the issue either by making a modified version for themselves, or switching to another library, so there are several implementations of a timeout that are simple and would easily solve the issue.

But arduino developpers stubbornly refuse to fix it !

You think I'm rude ? After 9 years of giving the finger on this issue to the whole community for absolutely no reason, I couldn't care less.

How long before you close it again ?
Just be honest, and put a "[expletive deleted] you all, WONTFIX" label on it ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Library: Wire The Wire Arduino library Type: Duplicate Another item already exists for this topic
Projects
None yet
Development

No branches or pull requests

4 participants