I'm using an I2C network to connect a couple of Arduclemas (an Arduino derivative with screw terminals on all pins, and I2C pullUp resistors).
My problem is this: if one node card (microcontroller) fails or leaves the network, the Master seems to block indefinitely while doing Wire.endTransmission(). I can't seem to find a way to check if the node is alive before talking to it, or recover gracefully (and quickly) when the communication fails. The ideia is to have a timeout when communicating; if it takes more than a few ms just return in error and keep going.
The slave device isn't acknowledging what is sent to it by pulling the pin low. The I2C bus was never meant to be used in this way of being able to plug and unplug devices.
Of course what you need to do is to make that write call a non blocking call by having a time out in it. Unfortunately a quick look does not reveal where it is.
Maybe some softie can help.
that was always a thorn in my side as well... yet i never really made something about it because i always thought someone else would do it who has more knowleadge about avr programming.
Seeing it as it is - wouldnt it be possible to do something like:
(Pseudocode)