attiny45 digital low not 0V

So I have an attiny 45 on a pcb and it’s job is to toggle the shut down pin on an external buck boost converter from pololu. Also attached to this pin is a 910 ohm current limit resistor and an smt led for visual indication.

When I do not have the buck boost attached then the pin I’m using (digital 3) goes to 0V but once I attach the buck boost it won’t drop below ~1.2V.

First I guessed that the pullup resistor might result in too much current sinking into the pin (it’s a long shot I know) but I checked the schematic and the board and the pullup was 100K so the sink current is minimal.

Next I tried using a nano that I had laying around and the buck boost worked just fine.

I broke out the multimeter and measured the current sinking into the pin and found it to be about 25uA

What else could be causing a pin to not drop to 0V? I have tried everything that I can think of.

I do set the pin to output in my code

One thing I realized is that after writing the pin low I put the system to sleep to save power. Can a pin not hold its state when the microcontroller is sleeping?

Here is a copy of the sleep functions

void system_sleep(int duration) {
for(int i=0;i<duration;i++){
cbi(ADCSRA,ADEN); // switch Analog to Digitalconverter OFF

set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here

sleep_mode(); // System sleeps here

sleep_disable(); // System continues execution here when watchdog timed out

sbi(ADCSRA,ADEN); // switch Analog to Digitalconverter ON

// 0=16ms, 1=32ms,2=64ms,3=128ms,4=250ms,5=500ms
// 6=1 sec,7=2 sec, 8=4 sec, 9= 8sec
void setup_watchdog(int ii) {

byte bb;
int ww;
if (ii > 9 ) ii=9;
bb=ii & 7;
if (ii > 7) bb|= (1<<5);
bb|= (1<<WDCE);

MCUSR &= ~(1<<WDRF);
// start timed sequence
WDTCR |= (1<<WDCE) | (1<<WDE);
// set new watchdog timeout value
WDTCR = bb;

// Watchdog Interrupt Service / is executed when watchdog timed out
ISR(WDT_vect) {
f_wdt=1; // set global flag

link to buck boost converter on pololu

Replaced the sleep behavior with a delay and the pin still won't hold low.

According to the schematic SHDN (aka EN) is tied to VIN (through a pullup resistor). If VIN is greater than 5.5 volts and you did not put a transistor between the processor and SHDN then there is a high probability you have permanently damaged the processor. Especially given this...

...but once I attach the buck boost it won't drop below ~1.2V.

As long as pullup resistor is weak enough (high resistance) there is little chance to damage the pin. Input protection diodes should survive a few mAs so unless VIN is in hunreds of volts the ATTiny should be safe provided the pullup is really 100k. But you should measure current flowing into the pin and try with known pullup to known voltage if the pin is working as expected

  1. Electrical Characteristics 21.1 Absolute Maximum Ratings*

Voltage on any Pin except RESET with respect to Ground ................................-0.5V to VCC+0.5V

*NOTICE: Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent damage to the device. This is a stress rating only and functional operation of the device at these or other conditions beyond those indicated in the operational sections of this specification is not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability.

What part of that do you not understand?


Look at Figure 10-1, pin equivalent schematic. There is a diode from the pin to Vcc. When Vpin>Vcc it opens and if the current is low enough it will protect the pin from being damaged. 100k resistor should limit the current to be safe (and voltage seen by the pin to < Vcc + 0.5). I don’t say it is something you should rely on for long time or in a vital project but I doubt the pin may be damaged by 100k pullup to a moderate voltage. The OP should look for a mistake elsewhere.

As a side note you can power AVR via any GPIO pin with Vcc floating via this diode. I don’t know how long the device may survive such misuse but for limited time it is possible.

Protection diodes may only tolerate a fraction of a mA continuous, note, they are there to meet the standards for static discharge protection, which is a pulsed use. If the datasheet has a spec for the protection diode continuous current you can go by that, otherwise just don't put it to the test, clamp with a schottky diode externally to protect the pin.

Yea the pin I'm using is pulled high to vin which maxes out around 4.8V so no problems there. I also checked the pullup and it was ~100K.

There is no transistor between the SHDN pin and the ATTINY pin as I didn't believe one was necessary given the few uA of expected current while each pin is rated for 40mA.

I didn't read your first post properly, you already measured current going into the pin. But are you sure the pin is configured as output? How exactly is the LED connected? From pin to GND? If so it looks like the pin is input or input with pullup all the time. Try if it can sink some curent with the LED disconnected. Try simple sketch just manipaling the pin to see if it works - it could be damaged before, during soldering or other handling or in some other setup.

MarkT: Protection diodes may only tolerate a fraction of a mA continuous, note, they are there to meet the standards for static discharge protection, which is a pulsed use. If the datasheet has a spec for the protection diode continuous current you can go by that, otherwise just don't put it to the test, clamp with a schottky diode externally to protect the pin.

Quick Googling found where is reference to Atmel's Application Note AVR182 about ZC detection. It states

"It is not recommended that the clamping diodes are conducting more than maximum 1mA". The Note's implementation let the diodes to conduct with about 50% of duty.

I configure the pin (digital 4) as output in my code and the led seems the correct brightness so I believe that is working. The pin is connected to a 910 ohm resistor and then an led to ground so it lights when the pin is high.

I removed the resistor so the led was no connected and still had the same behavior.

I did realize that my input pin (digital 3) does surpass Vin+0.5V under some circumstances but is still functioning properly. Could that have damaged something internally which affects my output?

Also I tried just running the blink sketch to reduce any possibility of a code error causing this and found the same behavior.

Theoretically I could swap the 100K pullup for a 100K pull down and that could be a work around right?

Are you using pin 3 or 4? Or you tried both?
What voltage uses the ATTiny? You said VIN is 4.8V so Tiny’s Vcc is under 4V? What speed is the Tiny running?
You cannot use pulldown resistor if Vcc<<Vin I guess because you won’t be able to pull the enable pin up.

Is the pin able to sink current? Use as simple sketch as possible:

void setup {
pinMode(4, OUTPUT);
void main{}

You are not using external clock, right?

EDIT: also are you sure the ATTiny is running while it should keep the enable pin low? Wrongly configured WDT can keep it in reset? Or possibly noise from the buck/boost may cause wrong operation?

I swapped chips and everything is working but I still havent determined the root cause of the failure.

I'm using 3 as an input and 4 as an output. I havent tried rigging any other pins in since I'm working on a pcb but I could.

The attiny is running on 2.5V to 5.5V (my input sources are a 1s lipo and a 6V solar panel both with some diodes). I thnk a pull down would work since the buck boost only needs 1.2V to be on and worst case I'd still be double that.

Tiny is running on the 1MHz internal clock

It definitely isn't resetting as the timing is working properly when I try blink in a few different timing scenarios.

If the pin is damaged it is hard to say what did it. It may be the high voltage but I still doubt it - an ESD event or brief short circuit somewhere looks much more probable to me. But the pull down resistor looks like better solution because you (hopefully) don't risk overvoltage in any case. It depends what project you are planning but for anything at least a bit important I would use a new ATTiny and keep the damaged one for experiments - such as how much current the protection diodes can withstand without immediate damage ;-)

A small N-channel fet, like the 2N7000, could solve your problem. Source to ground, drain to enable input, gate to Arduino pin. No other parts needed. That will allow the enable input to rise to the level of the buck converter's input. And will put zero strain on the Arduino pin. Invert pin logic in your code ofcourse. Leo..