Anyone Knows if this i2c easyTransfer variant by Bill Porter and Kumi is fit for a hot-swappable system?
If i use this and someone unexpectedly unplugs the connection and re plugs it, is it protected against this so it will not freeze the Arduino's?
I know the wire library can get stuck in a while loop...
I tried it and it did not freeze, when unplugging, however that is not really scientific....
Anybody able to read it in code?
The Arduino Wire library can get stuck in a loop, so it is not hot-swappable. The EasyTransferI2C is just a layer on top of the Arduino functions, nothing special about that, but the Wire library itself is the problem.
Since the EasyTransferI2C is 3 years old and uses the lower level TwoWire functions, it might not be compatible with the newer versions.
Ahh i see, that makes sense, seeing i included wire.h.....
easyTransfer does seem to work with the most recent wire. atleast it does for me...
I have 1 arduino talk with 2 others.
Why is the loop-getting stuck never addressed in wire? is this something that is more something to solve outside the library?
this seems like a rather anoyning habbit.
From what i understood, i2c is designed for chips that are on the same pcb, sure there this issue will never happen, but seeing the availabilaty of hardware with onboard i2c(all sorts of sensors). I would think it is interesting to a lot of projects to make this a hot swappable protocol. just for stabilaty sake.
Some have changed the Wire library with timeouts, but sadly that has not yet been added to the official Wire library. It is not related to I2C or the protocol, only the Wire library. As I understand, a few improvements have been made, but it still can block.
I think the SMBus is hot-swappable, read wikipedia about that.
I do disconnect and connect my Arduino I2C Slaves from/to the Master (also Arduino board). It is not easy to detect that, and I should implement a command to reset the Slave. My data doesn't have a checksum, but so far I had no problem.
When I did a test with the Multi Speed I2C scanner, the sketch was blocking at 600kHz or so. But even if my I2C bus can not do 600kHz, the Wire library should never block in an embedded system of course. Annoying is an understatement.