# Program ATtiny13 - 20PU

I'm trying to program my ATtiny 13 - 20PU. An it seems to work, but there is no action upon the "delay" command. If on the sketch below I comment out the "High" line, my led is off all the time and whenever I have a Pin 4 High, it's on all the time! Basically this seems to be a frequency/fuse/bootloader problem and made me think the upload was broken.

I added a led between the tiny's pin 3 (digital pin 4) and ground with a 1k current limiting resistor. This one is for testing with the attached sketch. I also tried this breadboard circuit, which gives exactly the same results.

Upon upload to the tiny I get this:

Sketch uses 380 bytes (37%) of program storage space. Maximum is 1,024 bytes.
Global variables use 8 bytes of dynamic memory.


(Everybody warns about 2 errors occuring upon a proper upload - I don't get those).

My boards.txt look like this:

menu.cpu=Processor

attiny.name=ATtiny
attiny.build.core=arduino:arduino
attiny.build.board=attiny

#################################################

################################################

################################################


And I choose the settings: Board ATtiny, Processor ATtiny13, Clock 9.6 MHz (internal), Port Arduino Uno (same as when I upload the ISP sketch), Programmer Arduino as ISP. I upload by clicking "Upload using Programmer".

Arduino Software is 1.6.4, the programmer Arduino is an Uno SMD edition. I used this programmer and this tutorial for smeezkitty core13.

I'm trying to upload this sketch:

// Blink sketch to test ATtiny Chips

//       ATMEL ATTINY13 / ARDUINO
//
//                 +-\/-+
// ADC0 (D 5) PB5 1|*   |8 Vcc
// ADC2 (D 4) PB4 3|    |6 PB1 (D 1) PWM1
//            GND 4|    |5 PB0 (D 0) PWM0
//                 +----+

const int LED_PIN = 4; // digital pin
const int DELAY_TIME = 1000; // time between blinks [ms]

void setup() {
pinMode(LED_PIN, OUTPUT);
}

void loop() {
digitalWrite(LED_PIN, LOW);
delay(DELAY_TIME);
digitalWrite(LED_PIN, HIGH);
delay(DELAY_TIME);
}


Trying to burn a bootloader with the same settings as uploading to the tiny and then tools -> burn bootloader, get's me the error:

"efuse" memory type not defined for part "ATtiny13"


Skimming through the data sheet I noticed that the tiny13 - 20PU (the 20) stand for 20 MHz,... theoretically one should be able to downclock them to the ordinary 10 MHz, but maybe this is my problem?

• Most likely a mistake in the construction of your ISP stripboard shield. I'd check for dry joints, uncut cuts, etc. – RedGrittyBrick May 9 '15 at 10:54
• I checked the connections many times now. And since nothing happens, when I try to upload using a breadboard-version, I guess there is some software issue, or I do something wrong. – mike May 9 '15 at 20:46
• The last time I programmed an ATtiny (an 85 in my case) using the ArduinoISP sketch, I had to set the IDE to use the right programmer: Tools -> Board -> ATtiny85 (w/ Arduino as ISP) and Tools -> Programmer -> Arduino as ISP - the messages you are seeing suggest the IDE is targetting an STK500 programmer. This may be right as several programmers emulate an STK500 - but it might be worth checking/experimenting with this. – RedGrittyBrick May 9 '15 at 22:22
• Yeah, as mentioned above, I've used ATtiny13 and Programmer Arduino as ISP. I have no clue, what is going wrong there. Or even how I can debug it further. – mike May 10 '15 at 8:12
• Arduino_ISP emulates the avrisp tool. You may try to add something like attiny.upload.protocol = avrisp to your boards.txt. – Edgar Bonet May 10 '15 at 15:51

There was some mistakes in the boards.txt it seems. After finding a very detailed and extensive boards file here, I modified it to have neat and tidy categories and is easier to use to become a working boards.txt. I had to burn the bootloader once to set the fuses right. After that everything works like a charm for 3 ATtiny13! No warnings or errors. This is used with Arduino 1.6.4. The folder tree is ~Arduino/hardware/attiny/avr/cores/core13 and ~Arduino/hardware/attiny/avr/boards.txt

# boards.txt for Arduino 1.6.4

attiny13.name=ATtiny13

#################################################
############## clock speeds #####################
#################################################

#### 9.6 MHz
############
attiny13.menu.clock.t13_9M6=9.6MHz (internal clock, Preserve EEPROM, BOD disable)

#### 9.6 MHz - 2.7V
attiny13.menu.clock.t13_9M6_bod=9.6MHz (internal clock, Preserve EEPROM, BOD - 2.7V)

#### 4.8 MHz - 2.7V
attiny13.menu.clock.t13_4M8_bod=4.8 MHz (int 4.8 MHz clock, Preserve_EEPROM, BOD - 2.7V)

#### 1.2 MHz
attiny13.menu.clock.t13_1M2=1.2 MHz (int 9.6 MHz divided by 8,Preserve_EEPROM, BOD - 2.7V)

#### 600 kHz
attiny13.menu.clock.t13_0M6=600 kHz (int 4.8 MHz divided by 8, Preserve_EEPROM, BOD disable)

## 128 kHz

## 16 kHz
attiny13.menu.clock.t13_16k=16 KHz (internal watchdog oscillator, Preserve_EEPROM, BOD disable)

##-----------------------------------
##--------- compiler flags ----------
##-----------------------------------