1

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
menu.clock=Clock

attiny.name=ATtiny
attiny.bootloader.tool=arduino:avrdude
attiny.bootloader.unlock_bits=0xff
attiny.bootloader.lock_bits=0xff
attiny.build.core=arduino:arduino
attiny.build.board=attiny
attiny.upload.tool=arduino:avrdude

attiny.menu.cpu.attiny45=ATtiny45
attiny.menu.cpu.attiny45.upload.maximum_size=4096
attiny.menu.cpu.attiny45.build.mcu=attiny45
attiny.menu.cpu.attiny45.build.variant=tiny8

attiny.menu.cpu.attiny85=ATtiny85
attiny.menu.cpu.attiny85.upload.maximum_size=8192
attiny.menu.cpu.attiny85.build.mcu=attiny85
attiny.menu.cpu.attiny85.build.variant=tiny8

attiny.menu.cpu.attiny44=ATtiny44
attiny.menu.cpu.attiny44.upload.maximum_size=4096
attiny.menu.cpu.attiny44.build.mcu=attiny44
attiny.menu.cpu.attiny44.build.variant=tiny14

attiny.menu.cpu.attiny84=ATtiny84
attiny.menu.cpu.attiny84.upload.maximum_size=8192
attiny.menu.cpu.attiny84.build.mcu=attiny84
attiny.menu.cpu.attiny84.build.variant=tiny14

attiny.menu.clock.internal1=1 MHz (internal)
attiny.menu.clock.internal1.bootloader.low_fuses=0x62
attiny.menu.clock.internal1.bootloader.high_fuses=0xdf
attiny.menu.clock.internal1.bootloader.extended_fuses=0xff
attiny.menu.clock.internal1.build.f_cpu=1000000L

attiny.menu.clock.internal8=8 MHz (internal)
attiny.menu.clock.internal8.bootloader.low_fuses=0xe2
attiny.menu.clock.internal8.bootloader.high_fuses=0xdf
attiny.menu.clock.internal8.bootloader.extended_fuses=0xff
attiny.menu.clock.internal8.build.f_cpu=8000000L

attiny.menu.clock.external8=8 MHz (external)
attiny.menu.clock.external8.bootloader.low_fuses=0xfe
attiny.menu.clock.external8.bootloader.high_fuses=0xdf
attiny.menu.clock.external8.bootloader.extended_fuses=0xff
attiny.menu.clock.external8.build.f_cpu=8000000L

attiny.menu.clock.external16=16 MHz (external)
attiny.menu.clock.external16.bootloader.low_fuses=0xfe
attiny.menu.clock.external16.bootloader.high_fuses=0xdf
attiny.menu.clock.external16.bootloader.extended_fuses=0xff
attiny.menu.clock.external16.build.f_cpu=16000000L

attiny.menu.clock.external20=20 MHz (external)
attiny.menu.clock.external20.bootloader.low_fuses=0xfe
attiny.menu.clock.external20.bootloader.high_fuses=0xdf
attiny.menu.clock.external20.bootloader.extended_fuses=0xff
attiny.menu.clock.external20.build.f_cpu=20000000L


#################################################
attiny.menu.cpu.attiny13=ATtiny13
attiny.menu.cpu.attiny13.upload.maximum_size=1024
attiny.menu.cpu.attiny13.build.mcu=attiny13
attiny.menu.cpu.attiny13.build.variant=core13

attiny.menu.clock.internal96=9.6MHz (internal)
attiny.menu.clock.internal96.bootloader.low_fuses=0x7A
attiny.menu.clock.internal96.bootloader.high_fuses=0xff
attiny.menu.clock.internal96.build.f_cpu=9600000L
################################################

attiny.menu.clock.internal48=4.8MHz (internal)
attiny.menu.clock.internal48.bootloader.low_fuses=0x79
attiny.menu.clock.internal48.bootloader.high_fuses=0xff
attiny.menu.clock.internal48.build.f_cpu=4800000L
################################################

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
// ADC3 (D 3) PB3 2|    |7 PB2 (D 2) ADC1
// 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"
Error while burning bootloader.

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?

6
  • Most likely a mistake in the construction of your ISP stripboard shield. I'd check for dry joints, uncut cuts, etc. Commented May 9, 2015 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
    Commented May 9, 2015 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. Commented May 9, 2015 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
    Commented May 10, 2015 at 8:12
  • Arduino_ISP emulates the avrisp tool. You may try to add something like attiny.upload.protocol = avrisp to your boards.txt. Commented May 10, 2015 at 15:51

2 Answers 2

1

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

menu.flag=GCC Flags
menu.cpu=Processor
menu.clock=Clock

attiny13.name=ATtiny13
attiny13.upload.tool=arduino:avrdude
attiny13.upload.using=arduino:usbtiny

attiny13.bootloader.tool=arduino:avrdude

attiny13.menu.cpu.attiny13=ATtiny13
attiny13.menu.cpu.attiny13.upload.maximum_size=1024
attiny13.menu.cpu.attiny13.upload.maximum_data_size=64
attiny13.menu.cpu.attiny13.build.mcu=attiny13
attiny13.menu.cpu.attiny13.build.core=core13
# attiny13.menu.cpu.attiny13.build.variant=core13

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

#### 9.6 MHz
############
attiny13.menu.clock.t13_9M6=9.6MHz (internal clock, Preserve EEPROM, BOD disable)
attiny13.menu.clock.t13_9M6.bootloader.low_fuses=0x3A
attiny13.menu.clock.t13_9M6.bootloader.high_fuses=0xFF
attiny13.menu.clock.t13_9M6.upload.speed=57600L
attiny13.menu.clock.t13_9M6.build.f_cpu=9600000L

#### 9.6 MHz - 2.7V
attiny13.menu.clock.t13_9M6_bod=9.6MHz (internal clock, Preserve EEPROM, BOD - 2.7V)
attiny13.menu.clock.t13_9M6_bod.bootloader.low_fuses=0x32
attiny13.menu.clock.t13_9M6_bod.bootloader.high_fuses=0xFB
attiny13.menu.clock.t13_9M6_bod.upload.speed=57600L
attiny13.menu.clock.t13_9M6_bod.build.f_cpu=9600000L

#### 4.8 MHz - 2.7V
attiny13.menu.clock.t13_4M8_bod=4.8 MHz (int 4.8 MHz clock, Preserve_EEPROM, BOD - 2.7V)
attiny13.menu.clock.t13_4M8_bod.bootloader.low_fuses=0x31
attiny13.menu.clock.t13_4M8_bod.bootloader.high_fuses=0xFB
attiny13.menu.clock.t13_4M8_bod.upload.speed=57600L
attiny13.menu.clock.t13_4M8_bod.build.f_cpu=4800000L

#### 1.2 MHz
attiny13.menu.clock.t13_1M2=1.2 MHz (int 9.6 MHz divided by 8,Preserve_EEPROM, BOD - 2.7V)
attiny13.menu.clock.t13_1M2.bootloader.low_fuses=0x2A
attiny13.menu.clock.t13_1M2.bootloader.high_fuses=0xFB
attiny13.menu.clock.t13_1M2.upload.speed=9600L
attiny13.menu.clock.t13_1M2.build.f_cpu=1200000L

#### 600 kHz
attiny13.menu.clock.t13_0M6=600 kHz (int 4.8 MHz divided by 8, Preserve_EEPROM, BOD disable)
attiny13.menu.clock.t13_0M6.bootloader.low_fuses=0x29
attiny13.menu.clock.t13_0M6.bootloader.high_fuses=0xFF
attiny13.menu.clock.t13_0M6.upload.speed=9600L
attiny13.menu.clock.t13_0M6.build.f_cpu=600000L

## 128 kHz
attiny13.menu.clock.t13_128k=128 KHz (internal watchdog oscillator)
attiny13.menu.clock.t13_128k.bootloader.low_fuses=0x7B
attiny13.menu.clock.t13_128k.bootloader.high_fuses=0xFF
attiny13.menu.clock.t13_128k.upload.speed=250
attiny13.menu.clock.t13_128k.build.f_cpu=128000L

## 16 kHz
attiny13.menu.clock.t13_16k=16 KHz (internal watchdog oscillator, Preserve_EEPROM, BOD disable)
attiny13.menu.clock.t13_16k.bootloader.low_fuses=0x2B
attiny13.menu.clock.t13_16k.bootloader.high_fuses=0xFF
attiny13.menu.clock.t13_16k.upload.speed=250
attiny13.menu.clock.t13_16k.build.f_cpu=16000L



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

attiny13.menu.flag.Os=Default
attiny13.menu.flag.Os.compiler.c.extra_flags=
attiny13.menu.flag.Os.compiler.c.elf.extra_flags=
attiny13.menu.flag.Os.compiler.cpp.extra_flags=

attiny13.menu.flag.Os_flto=Default -flto
attiny13.menu.flag.Os_flto.compiler.c.extra_flags=-Wextra -flto
attiny13.menu.flag.Os_flto.compiler.c.elf.extra_flags=-w -flto
attiny13.menu.flag.Os_flto.compiler.cpp.extra_flags=-Wextra -flto

attiny13.menu.flag.O1=-O1
attiny13.menu.flag.O1.compiler.c.extra_flags=-O1
attiny13.menu.flag.O1.compiler.c.elf.extra_flags=-O1
attiny13.menu.flag.O1.compiler.cpp.extra_flags=-O1

attiny13.menu.flag.O1_flto=-O1 -flto
attiny13.menu.flag.O1_flto.compiler.c.extra_flags=-O1 -Wextra -flto
attiny13.menu.flag.O1_flto.compiler.c.elf.extra_flags=-O1 -w -flto
attiny13.menu.flag.O1_flto.compiler.cpp.extra_flags=-O1 -Wextra -flto

attiny13.menu.flag.O3=-O3
attiny13.menu.flag.O3.compiler.c.extra_flags=-O3
attiny13.menu.flag.O3.compiler.c.elf.extra_flags=-O3
attiny13.menu.flag.O3.compiler.cpp.extra_flags=-O3

attiny13.menu.flag.O3_flto=-O3 -flto
attiny13.menu.flag.O3_flto.compiler.c.extra_flags=-O3 -Wextra -flto
attiny13.menu.flag.O3_flto.compiler.c.elf.extra_flags=-O3 -w -flto
attiny13.menu.flag.O3_flto.compiler.cpp.extra_flags=-O3 -Wextra -flto
1
0

The "efuse error" on burning the bootloader is described in the article you refer to and a solution is given there as well. It occurs when the attiny13 is defined in the same group as the attiny25/45/85 as the former has no efuse and the latter do.

Giving the attiny13 its own menu entry in the IDE -as described in that article- should solve that.

1
  • Welcome to Arduino SE! Can you please edit your answer to explain how this is done? Thanks! Commented May 23, 2015 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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