-
-
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
I2C/Wire library: Make Wire library non-blocking #1476
Comments
Agree, this is crucial. If you have 20 sensors plugged in to arduino and one goes damaged/unplugged, everything freezes! |
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. |
This just sucks :( |
Agreed, the proposed solutions should work fine and this is a much needed bug-fix. |
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. |
…ut in milliseconds.
This is ridiculous - are we ever going to fix this? |
try this dropin replacement: |
@IanSC: What is the best way to replace the default wire library? Do you have and experience on this? |
I'm closing this issue, in favor of arduino/ArduinoCore-avr#42 (which is in the, now, correct repository). |
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 ... 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 ? |
Yeah, still a problem in 2022 in Arduino 1.8.19. My Waiting for a reply on rambo/I2C#12 before switching to that. |
Quoting @matthijskooijman answer for future reference:
|
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
The text was updated successfully, but these errors were encountered: