I see the wire library has been updated and i've been looking all around for the changes done to see whether the blocking/freezing still persists or if it's been fixed. this is because after updating my IDE from 1.6.5 or below using my modified twi.x files with timeouts dont seem to be compatible with the new wire library included in the IDE 1.6.6/1.6.7 giving off compiling errors. anyone have any ideas on whats been updated or do we still need to inject timeouts in the newer library? thank you Tony
Nope, just blocked after a few hours, hopefully the whole wire library can be rolled back and work with 1.6.7…
You have a bad I2C bus, you should fix that.
Suppose someone designs a board with a processor and with memory half a meter away. Then the processor might go nuts because the address and data signals are terrible. It is the same for the I2C bus. It is a bus to be used on a board, and it can't go through a cable.
Here is the wire library. The "utility" is the twi files. Github keeps track of the changes. https://github.com/arduino/Arduino/tree/master/hardware/arduino/avr/libraries/Wire
The Wire library is still blocking, that is a big shame for an embedded system. When something is wrong outside the microcontroller, the software inside it should never stop.
May be the bus… or not, i know i am not alone, i learn arduino through research and reading forums and this is a common issue with wire, i was just curious on the update… anyways i have had about 3 freezes since yesturday guess ill roll back the old library, wasnt having any issues or random crash/or false triggers with modified twi, and besides, using the adafruit pwm i2c controller wire is a no choice option :)
I keep waiting until the official library is no longer blocking... and waiting... and waiting.
I’m using the Due and have had horrible problems with connecting to I2C devices. Not as much with the Uno, but my sensors are 3.3V. Does anybody have any suggestions on how to fix the wire library for the Due?
I'm stuck with the problem of wire.endTransmission hanging. I gather there is a problem with the wire library. Is there and update? I am running 1.8.4 IDE on Windows 10.
I too have had problems with I2C, and after much experimentation it was clear the root problem is the blocking while() loops in twi.c.
Just like the posters here, I have tried to figure out why the original Wire library (with the broken twi.c) hasn't been fixed. Here's what I've found so far:
The 'StreamFire' wire library at https://github.com/steamfire/WSWireLib has the modifications that prevent infinite 'while()' loops originally posted two years earlier (September 2010) by 'unaie' in http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1283887406. The StreamFire library was posted in 2012.
There is a 'I2C Master Library' written by DSSCircuits in September 2012, that modified the Wire library to accommodate the 'repeated starts' feature. I'm not an I2C expert, but apparently the 'repeated starts' feature is useful for at least some extant hardware. AFAIK, this library still uses the original twi.c/h with the same blocking while() loops.
I made a local modification to the Wire library for my own use that merges the code from the 'I2C Master Library' and the twi.c/h changes posted by unaie, along with changes to the Wire class to allow the 'lockup reset counter' to be reset to zero and to be displayed by the user's arduino program. This version is available on my 'Paynter's Palace' blog site at http://fpaynter.com/2018/08/integrating-time-memory-and-heading-capability-part-v/. I tested this code on a project that would regularly lock up after a few hours at most, and the same hardware ran for 3 days without lockups before I had to shut it down for other reasons.
So, it appears we have all the code and modifications we need to eliminate the I2C lockups - but nobody has figured out how to get that version into the basic Wire library that ships with Arduino. Does anyone have a clue who 'owns' this library and how we can get these modifications made?