2

I have a group of four Arduino boards connected via I2C. One is the master, which sends and receives values from all of the others. I noticed that the Master will stop executing its loop if power is removed from one of the other Arduino boards.

Can one Arduino in a I2C group cause the rest to freeze? Is there a way to prevent this?

I am using one of the Arduino boards to connect to a server via network shield and I don't want the other Arduino boards to be effected if the networked Arduino freezes.

  • It really depends on the code that you are using. Can you pair down your code and post the master and slave i2c portions so we can have a look? – portforwardpodcast Mar 30 '15 at 23:43
  • I wish I still had it, but that code got re written and I have not seen the problem again. If I se it happen again , I'll update the question. – Hoytman Mar 31 '15 at 22:55
  • More specifically, the question should really be if the I2C code (library?) and any surrounding code can handle failures of the remote end, or it if will sit and wait forever, and if it can possibly get into a state that is not recoverable even if the remote end does start operating normally again (such as after the remote, but not local, end is reset). – Chris Stratton May 14 '15 at 13:57
  • Sounds like the unpowered node pulled down the I2C +5V. I've also had I2C devices not work when the arduino is powered by 5V plug (but does with USB power). – Chris K May 29 '15 at 0:33
1

There are a number of places in the standard Wire library where the code goes into a tight loop waiting for an interrupt to occur. If that is missed for some reason, it will loop indefinitely.

By removing power from one of your devices you may be introducing electrical conditions that prevent the I2C messages from being transmitted properly (possibly just noise). Alternatively the device may parasitically power up from the SDA/SCL data and then behave in unpredictable ways. It is probably unwise to do this.

There is an alternative I2C master library at http://dsscircuits.com/articles/arduino-i2c-master-library which does not hang (I believe it times out instead).

0

I can say from personal experience, I had a similar event. I had a logic analyzer hooked up and was using it. I got the code working the way I wanted. A day later when I tried it the code failed. Turned to be because I had not powered up the logic analyzer and it was still hooked up. If I unhooked it or powered it on everything worked fine. This was on an Netduino BTW, but it leads me to believe (not being an electronics person per se) that yes it very possible if some unexpected load is on the I2C bus.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.