Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

MCU: ATTiny13

I noticed this after trying to debug why pushing my switch (connected via R2, a 507kOhm pulldown resistor) makes the LED dimmer while depressed. The switch was powered by the same supply line as the Vcc input to the microcontroller.

Upon disconnecting the Vcc input (Pin 8), I noticed that the LED was still lit when the switch was depressed. If I removed a connection from the ground pin 4, the LED still lit up, but less brighter.

The circuit below represents what I observed. The switch is removed to simplify the problem:

enter image description here

Why does this happen, and how can I stop it? It is interfering with the output when the button is depressed.

Here is a picture of the circuit on a breadboard. The supply line (5V is the red wire, Ground is black):

enter image description here

share|improve this question
1  
Sounds like a construction problem. By that schematic, there is no way the LED could light up with Vcc disconencted. Of course, without the micro's Vcc pin connected, a whole lot of nothing is going to happen. –  Matt Young Aug 1 at 14:17
1  
Can you show the switch in your circuit? –  Scott Seidman Aug 1 at 14:19
4  
Surely that isn't the whole circuit. Almost certainly one of the I/O pins is being held at Vdd or is being pulled up to Vdd. –  Olin Lathrop Aug 1 at 14:32
2  
Connecting an I/O pin to a higher voltage than VCC leads to undefined behavior in case of many microcontrollers. The microcontroller is in an undefined state and anything can happen. –  vsz Aug 1 at 15:21
2  
No, that clearly can't be what you actually hooked up. If it were connected according to your description, there would be no source of power at all, and therefore no way for the LED to light. Perhaps the bottom of R2 is actually connected to Vdd? –  Olin Lathrop Aug 1 at 17:02

5 Answers 5

up vote 21 down vote accepted

Inputs of many modern CMOS devices have ESD protection diodes from the I/O pins to the supply rails, which hope to divert transient overvoltages to the supply before they cause damage.

A side effect of this is that the chip can, at least to a degree be powered through an I/O pin, once the pin rises enough against the (unsupplied) supply to forward bias the diode. Even in technologies without explicit protection diodes, it could happen to a degree, though often resulted in very unreliable operation (classic mistake - forget to power a chip and see it "sort of" work - I did it myself with an SPI flash this past January that somehow never got a ground, and would provide expected responses right up until I tried to write flash locations).

Generally you do not want to power a chip this way - it is outside the absolute maximum ratings, and the protection diode may not be sized to carry the full operating current. You do see it at times though, both in intentional experiments, such as an RF-powered ATTiny RFID tag emulator experiment, or accidentally in cases such as trying to measure power consumption of a sleeping MCU and having it actually draw power from your serial debug port rather than the supply you are trying to measure.

share|improve this answer
1  
Thanks, makes sense to me. Is this the same reason the LED becomes dimmer when I make the input pin's voltage high? Do I just have to use a series resistor to lower the input voltage to fix this? –  tgun926 Aug 1 at 14:27
1  
That could not be answered without seeing the schematic and the program code. Sounds like its own question. –  Chris Stratton Aug 1 at 14:30
1  
Good answer. I've done this with Microchip processors as well. Bugger of time figuring it out the first time. –  Adam Head Aug 1 at 15:51

The datasheet for your device has this table:

enter image description here

In this table, VCC means the voltage applied to the VCC pin, not the net in your circuit which you have labelled VCC.

Since you have not applied any voltage to the VCC pin, you must not apply more than 0.5V to any other pin. Your PB4 connection is violating this rule.

share|improve this answer

Current flows thru internal clamping diodes.

Internal circuitry (simplified) looks like this:

enter image description here

In this Atmel document (random application note containing information about clamping diodes) you can read:

To protect the device from voltages above VCC and below GND, the AVR has internal clamping diodes on the I/O pins (see Figure 1). The diodes are connected from the pins to VCC and GND and keep all input signals within the AVR’s operating voltage (see Figure 2). Any voltage higher than VCC + 0.5V will be forced down to VCC + 0.5V (0.5V is the voltage drop over the diode) and any voltage below GND - 0.5V will be forced up to GND - 0.5V.

share|improve this answer

Just a addendum to Chris Strattons correct answer.

You are indeed powering the device through the protection diodes. There are several ways of providing ESD protection and all of them involve using diodes on the pins to connect to a rail inside. So your conduction path and internal power of your chip will be at least 1 diode drop below the supplied "power" on the pin.

You can test this out by measuring the the Vcc pin it will be about 0.7V lower than Vcc.

When you disconnect the ground, you are pulling less current through the protection diodes and shifting the operating point of the voltage supplied to the LED. But by a little bit, so this may not account for the difference.

The protection diodes are designed to handle Amps of current during a ESD strike so they are fine with this little trickle.

Your danger in operating the chip this way is that you could induce latch up, but most chips are designed to be able to NOT latch up in these conditions so that isn't a concern so much. But a possibility.

Another danger will depend upon what the exact nature of the ESD protection on chip. If it is a clamping style and you have a high dV/dT event then the clamp might fire and short out the supply. But this is also unlikely.

share|improve this answer
3  
"The protection diodes are designed to handle Amps of current during a ESD strike so they are fine with this little trickle." This is a fallacious viewpoint. An ESD strike is a transient, that consists of quite a small charge, so low energy dissipation, even if the instantaneous voltage and current are large. Running current continuously through these diodes will cause heat problems that don't occur during the ESD transient. –  Ben Voigt Aug 1 at 15:48
2  
"The protection diodes are designed to handle Amps of current during a ESD strike so they are fine with this little trickle." not sure I agree. I've seen data sheets (Xilinx spartan FPGAs for example) which allow you to use the protection diodes with a series resistor for level-shifting, but specify a fairly low maximum current, which you must use to size the resistor. IIRC the limit would be around just lighting a single LED, though that was a finer-grained technology, so it might be higher for this part, if Atmel chose to characterize it. –  Chris Stratton Aug 1 at 15:50
2  
The apparent conclusion that this implies you can safely power the chip does not follow. Why, for example, does Xilinx tell you the limit for current through Spartan 3 protection diodes which they do allow you to forward bias is a mere 10 mA? xilinx.com/support/answers/19146.htm –  Chris Stratton Aug 1 at 17:56
2  
@placeholder: Who said that "currents during an event are low"? Low resistance in this scenario actually makes heating during continuous flow worse, since the power dissipation is $V^2/R$. This in contrast to an ESD event where the charge transferred is pretty much fixed and the resistance doesn't affect the total energy dissipation. What the low resistance does provide is that very little of the charge will choose any other path. But that low resistance in the path doesn't mean there is good thermal dissipation... –  Ben Voigt Aug 1 at 17:57
2  
@placeholder: All your HBM analysis makes assumptions that are inapplicable to continuous currents. For ESD, the energy is $$q \Delta V$$. For this question, it is $$\int \frac{V^2}{R} dt$$ –  Ben Voigt Aug 1 at 18:35

You are probably powering the device through its protection diodes BUT the important thing is that you are doing something which is "illegal" and completely outside specification and anything can happen and you should not be surprised if it does.

Your circuit diagram is WRONG.
This is the REAL circuit diagram that you are using:

enter image description here

This is a hardware version of "garbage in, garbage out".

If you do something random and get a random result you should be happy - the universe is working as you'd expect.

More later maybe ...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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