ATtiny85 does not start when a input is low

Dear all,

I have a ATtiny85 USB board with a pin configured as an input.
If at power-up the input is LOW it does not boot correctly (no flashing LED, nothing happens)
If at power-up the input is HIGH, it works OK (10 flashes and then the program starts and responds to the input)
I tried other pins but the problem is still the same, am I missing something?


There is a bug in the code which you did not post. Since we can't see the code, literally cannot provide further guidance here....

Dear DrAzzy,

I thought it maybe has to do with certain pins that cannot be HIGH or LOW during boot…

Anyway, attached the code, I want to use the ATtiny85 as an external watchdog for my ESP8266 weather station.
The ESP8266 sends pulses (heartbeats), if the ATtiny85 does not receive a hardbeat for 3 minutes it resets the ESP8266.
Problem is the ATtiny85 does not boot when a pin is LOW on startup.

Thanks in advantage!

ATtiny85 External watchdog.ino (3.98 KB)

People hates having to download and open the file. We prefer you post the sketch inside the code tag. The </> symbol above the text box

Here, I copied the sketch and posted it for you.

// /----------------------\
// |  O   - /------\   P5 |  Not used        -
// |/---\ - |ATtiny|   P4 |  Reset_PIN       Output       Reset pin to other uC
// ||   | - \------/   P3 |  NoLED_PIN       input        If LOW flash LED will flash with heartbeat
// ||USB| -  =    =    P2 |  HB_PIN          input        HB pin from other uC
// ||   | -   /78\     P1 |  LED_PIN         Output       Output onboard LED that will flash with HB and during reset
// |\---/ -   \05/     P0 |  Not used        -
// |  O     5V GND Vin    |
// \----------------------/
//           |   |  \------- Not used        -            Vin goes to a 7805 (max 16V)
//           |   \---------- 0 V             -            Ground
//           \-------------- 5V              -            5V allows 3.3V
const int LED_PIN   = 1;                                                                          //Onboard LED
const int HB_PIN    = 2;                                                                          //Hartbeat pin from uC
const int NoLED_PIN = 3;                                                                          //NoLED pin
const int Reset_PIN = 4;                                                                          //Reset pin to uC
bool      LastHB     = false, CurrentHB   = false;                                                //last and current HB status
const int DT         = 100,   MaxTimeNoHB = (1000/DT)*60*3;                                       //delay time (DT), max time no HB
int       SecNoHB    = 0;                                                                         //Counter no HB
void setup()
{ pinMode(LED_PIN,OUTPUT);
  pinMode(Reset_PIN, OUTPUT); digitalWrite(Reset_PIN, HIGH);
void loop()
{ delay(DT);                                                                                      //wait for a while
  LastHB = CurrentHB;                                                                             //last HB signal 
  CurrentHB = digitalRead(HB_PIN);                                                                //read current HB signal
  if (LastHB != CurrentHB)                                                                        //if HB changed reset counter, if not increase counter
  { SecNoHB = 0;                                                                                  //set counter to 0
    if (digitalRead(NoLED_PIN) == LOW) { digitalWrite(LED_PIN, HIGH); } }                         //Signal HB change detected ON
  { SecNoHB++;                                                                                    //increase counter
    if (digitalRead(NoLED_PIN) == LOW) { digitalWrite(LED_PIN, LOW);  } }                         //Signal HB change detected OFF

  if (SecNoHB > MaxTimeNoHB)                                                                      //if time to long
  { digitalWrite(Reset_PIN, LOW);                                                                 //send reset signal
    for (byte i = 0; i <= 20; i++) { delay(50); digitalWrite(LED_PIN, !digitalRead(LED_PIN)); }   //Flash 20 times to signal reset, also delay
    SecNoHB = 0;                                                                                  //reset couter
    digitalWrite(Reset_PIN, HIGH);                                                                //stop reset signal
    digitalWrite(LED_PIN,   LOW);                                                                 //Make sure LED is off

the ATtiny85 does not boot when a pin is LOW on startup

Which pin?

I tested all pins, the ATtiny85 won't startup when P1, P3 or P5 is connected to ground.
Maybe P3 because it is USB+, but why also P1 & P5?

Please post a complete wiring diagram, including whatever ELSE is connected to the ATtiny, and describe how the parts are powered.

You may have a ground loop, resulting from two different, improperly grounded power supplies interacting.

Thanks for your response!
I did not implement it yet, it is only the ATtiny85 on a breadboard, nothing else.
I tried powering with USB and 3.3V power supply, both with the same result.
Maybe it's just a bad chip, I've ordered a new one to see if it will work.
If you have any other ideas please let me know.

Which pin 5 do you mean? arduino pin 5? or physical pin 5? Similarly, which pin 1?

I ask, because Arduino pin 5, physical pin 1 is reset. Assuming that RSTDSBL isn't set (sometimes it is with digispark devices), the chip will be held in reset while that pin is held low...

It is Arduino pin P5, since this is the reset it explains why P5 to GND will not boot, thanks!
Maybe P3 to GND does not boot because it is USB+, but why also P1?
I know on ESP8266 some pins determine startup state,
so I searched the ATtiny85 234 pages datasheet for words like "boot" and "start",
but couldn’t find anything.

so I searched the ATtiny85 234 pages datasheet for words like "boot" and "start"

What did you expect to find?

I hoped to find a list with pins that cannot be LOW during bootloading.
I've ordered a new one to see if it has the same behavior.

Any pin labeled as RESET can’t be held low at all unless you need to reset the MPU. Typically it’s connected through a resistor (10k typical) to VCC and a button to ground for manual reset. The same pin is also connected to serial and ISP for programming.

The pin can be reprogrammed to be a general input and output but you will need a high voltage programmer afterward because you won’t be able to initiate a reset to upload new code.