Using ATMega as I2C slave and powering down MCU causes line hang

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using an ATMega324PB Xplained board as my I2C master and several custom boards with 324PBs as the slave devices. I also have a MCP23008 which I planned to use to turn on and off the slave devices. However, it appears that when I power down a slave device it causes the entire I2C line to hang. Once I unplug the SDA line (and only the SDA line) of the offending card, the program resumes normal operation. 

 

So my question is, why? I know I had an issue with unprogrammed 324s hanging my line, but I understood that that was because it was powering up the port as a digital input with latched pull-ups. However, I at least assumed that powering off an I2C device would leave the pins floating, as the spec says. Am I just screwed, or am I overlooking something? 

 

Thanks in advance. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I2C bus was never designed to have slaves come and go, or to be powered off while the others are on. 

Every AVR micro has port protection diodes to each power rail, VCC & GND, so if the VCC is disconnected, power will flow from the powered pin into the port, through the diode to the VCC rail.

 

This phantom power MAY try to power up the device!  This is true for any multi-cpu project, not just the I2C ones.

 

Why do you want to do this?

 

 

Jim

 

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why do I want to power down devices? Why, to save power, of course. Why else would you do this? I have a series of cards being controlled by the master, and the user may only need 3 of the ten cards running at any given time. We are also looking into adding failover support because these cards have power electronics that can be prone to failure. In this scenario we'd have a duplicate card sitting on the line waiting to be powered up in case of a failure from another. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In that case, you will need external h/w to disconnect each unit when it is powered down to prevent the phantom power problem! 

MOSFET perhaps!?!

 

Jim

 

 

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just thought of an alternative, instead of powering off the mpu, put it to sleep.

Just before entering sleep mode, enable I2C address wakeup, then on address match unit will be active.

This way power usage is low, uA's, but in a known state.

 

Jim

 

 

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The issue, unfortunately, is that the cards have power electronics on them which need to be powered down; I'm not actually worried about the fraction of an amp that's running through the MCU. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

So just cut the feed to the power section and keep the MCU powered up.

Letting the smoke out since 1978

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah, but we are already out of pins on the micro. This will be fore the next revision of cards; I'm going to use these level converters/line isolators for this run. http://www.ti.com/lit/ds/symlink...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, what you describe will happen, and it happens exactly as KI0BK describes. 

 

Try an I2C addressable bus mux. NXP has them and I'll bet TI does also. Those should come very close  to solving your problem. Or,  maybe a bus level translator at each card bus connection. When the card power goes down, that should take the slave-side bus voltage down with it, providing a degree of isolation with respect tot he master. Level translators should take no MCU pins or addressing.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Last Edited: Fri. Sep 8, 2017 - 08:23 PM