Closed

Description
The Wire library has while loops that could go on forever. Although this will not happen in a normal situation, if it happens, the blocking stops the Arduino from working and that could be a safety issue.
Arduino version 1.0.5
A simple loop as timeout could solve this, as suggested here, http://diydrones.com/forum/topics/i2c-wiring-library-lockup
A non-blocking version was also made in 2011 by gknight4, http://forum.arduino.cc/index.php/topic,70705.0.html
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
marekhalmo commentedon May 21, 2016
Agree, this is crucial. If you have 20 sensors plugged in to arduino and one goes damaged/unplugged, everything freezes!
Please fix this :(
imval commentedon Jun 3, 2016
Issue is opened since almost 3 years :/ Is there anyone that can do something about this bug ? I have big issues with this, I'll probably use a timeout in the loop.
marekhalmo commentedon Jun 16, 2016
This just sucks :(
juanmalunatic commentedon Sep 21, 2016
Agreed, the proposed solutions should work fine and this is a much needed bug-fix.
dorinclisu commentedon Aug 17, 2017
Is this fix present in Arduino 1.6.10? Because I still have the issue, but I can't use the latest IDE due to other compatibility problems.
9 remaining items
IanSC commentedon Jun 19, 2019
try this dropin replacement:
https://github.com/IanSC/Arduino-Wire.h
cimba007 commentedon Aug 17, 2019
@IanSC: What is the best way to replace the default wire library? Do you have and experience on this?
matthijskooijman commentedon Sep 6, 2019
I'm closing this issue, in favor of arduino/ArduinoCore-avr#42 (which is in the, now, correct repository).
ermtl commentedon 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 :
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 ...
mattborja commentedon Apr 13, 2022
Yeah, still a problem in 2022 in Arduino 1.8.19. My
Wire.endTransmission()
still hangs if my IC is disconnected.Waiting for a reply on rambo/I2C#12 before switching to that.
cmaglie commentedon Apr 13, 2022
Quoting @matthijskooijman answer for future reference: