Need help with the attiny13a

Hello fellow people!

I recently bought some attiny13a's because I wanted to make a simple small circuit that flashes an led.
So I got them, set zup my arduino uno as in ISP hooked up the attiny to the arduino and uploaded my code. So far everything went smoothely. However, the LED will now always stay on, ignoring the code I wrote according to which it should turn of every other second.

I tried messing around with the code but nothing helped. It will just always stay On or Off (if I take out the line where it turns it on)

void setup() {

  pinMode(4, OUTPUT);
}


void loop() {
  digitalWrite(4, HIGH);   
  delay(1000);              
  digitalWrite(4, LOW);    
  delay(100);              
}

I would really apprectiate help here. I am completely new to this so excuse my possibly very stupid mistakes.

Thank you in advance
Jakob

PS: Sorry for my bad English

What speed is the tiny running at?

My first guess is that Arduino thinks it's running at a higher speed than it is. Make sure the fuses are programmed in the state you think they are for the speed specified in boards.txt (that FCPU is used to make delay() and other time-keeping functions work)

itÄs running at 20Mhz I believe.

so do i need to change the fcpu in the boards.txt to 20mhz?

as I already said, I am farily new to all of this :confused:

This is not every other second:

  digitalWrite(4, HIGH);   
  delay(1000);              
  digitalWrite(4, LOW);    
  delay(100);

That's on for 1 second, off for 1/10 second.

oh yeah, copied the old code. Doesn't change anything if I use 1000 for both though.

Also, I just found that if I switch the HIGH and the LOW around the LED doesn't light up at all.

Hi, are you using the internal oscillator or an external crystal ?

  • dan

SO I just fell dumber each time I say this but I really have no clue what an internal oscillator or an external crystal is.

Have you tried running that, and waiting 20 seconds?

My g

Jocobes:
itÄs running at 20Mhz I believe.

Not unless you've connected an external oscillator it's not.

The tiny13, along with most other atmel MCUs, ships set to use it's internal resonator, normally 8mhz, and to furthermore divide that clock rate by 8 (CKDIV8). Clock rates higher than the resonator require an external crystal or other clock source, as well as appropriate fuse settings.

FCPU must match the clock speed (in hz, ie, 8mhz = 8000000), otherwise timekeeping won't work.

The clock source and CKDIV8 (as well as various other clock settings) are in the low fuse. Be aware that if you set it to use an external clock source (crystal or clki), you can't program it (for example, to change it back to internal) without providing an external clock source.

Since it sounds like you haven't changed any of that, it's probably running at 1mhz, and if you did everything you just did, but then waited 20 seconds staring at the LED, you'd see it blink (just at 1/20th the speed you're expecting).

I'd either leave it at 1 (if all you're doing with it is basic blinkies) or switch off CKDIV8, and create entries in boards.txt appropriately.

yes I have. I've stared at it for quite a while...

Well but as far as I know I am not using an external oscilator..

Strange, I'd expect it to work, just at the wrong speed.

So if you're not using an external oscillator, it's running at ~1mhz or ~8mhz, depending on the CKDIV8 bit in low fuse. If you have not set the fuses (by either external tools or IDE 'burn bootloader'), it's running at 1mhz.

well I didnÄt really change any of the settings or anything in the boards.txt and yet my led refuses to blink

thought it might help if I post the content of my boards.txt

attiny45.name=ATtiny45 (internal 1 MHz clock)
attiny45.bootloader.low_fuses=0x62
attiny45.bootloader.high_fuses=0xdf
attiny45.bootloader.extended_fuses=0xff
attiny45.upload.maximum_size=4096
attiny45.build.mcu=attiny45
attiny45.build.f_cpu=1000000L
attiny45.build.core=arduino:arduino
attiny45.build.variant=tiny8

attiny45-8.name=ATtiny45 (internal 8 MHz clock)
attiny45-8.bootloader.low_fuses=0xe2
attiny45-8.bootloader.high_fuses=0xdf
attiny45-8.bootloader.extended_fuses=0xff
attiny45-8.upload.maximum_size=4096
attiny45-8.build.mcu=attiny45
attiny45-8.build.f_cpu=8000000L
attiny45-8.build.core=arduino:arduino
attiny45-8.build.variant=tiny8

attiny45-20.name=ATtiny45 (external 20 MHz clock)
attiny45-20.bootloader.low_fuses=0xfe
attiny45-20.bootloader.high_fuses=0xdf
attiny45-20.bootloader.extended_fuses=0xff
attiny45-20.upload.maximum_size=4096
attiny45-20.build.mcu=attiny45
attiny45-20.build.f_cpu=20000000L
attiny45-20.build.core=arduino:arduino
attiny45-20.build.variant=tiny8

attiny85.name=ATtiny85 (internal 1 MHz clock)
attiny85.bootloader.low_fuses=0x62
attiny85.bootloader.high_fuses=0xdf
attiny85.bootloader.extended_fuses=0xff
attiny85.upload.maximum_size=8192
attiny85.build.mcu=attiny85
attiny85.build.f_cpu=1000000L
attiny85.build.core=arduino:arduino
attiny85.build.variant=tiny8

attiny85-8.name=ATtiny85 (internal 8 MHz clock)
attiny85-8.bootloader.low_fuses=0xe2
attiny85-8.bootloader.high_fuses=0xdf
attiny85-8.bootloader.extended_fuses=0xff
attiny85-8.upload.maximum_size=8192
attiny85-8.build.mcu=attiny85
attiny85-8.build.f_cpu=8000000L
attiny85-8.build.core=arduino:arduino
attiny85-8.build.variant=tiny8

attiny85-20.name=ATtiny85 (external 20 MHz clock)
attiny85-20.bootloader.low_fuses=0xfe
attiny85-20.bootloader.high_fuses=0xdf
attiny85-20.bootloader.extended_fuses=0xff
attiny85-20.upload.maximum_size=8192
attiny85-20.build.mcu=attiny85
attiny85-20.build.f_cpu=20000000L
attiny85-20.build.core=arduino:arduino
attiny85-20.build.variant=tiny8

attiny44.name=ATtiny44 (internal 1 MHz clock)
attiny44.bootloader.low_fuses=0x62
attiny44.bootloader.high_fuses=0xdf
attiny44.bootloader.extended_fuses=0xff
attiny44.upload.maximum_size=4096
attiny44.build.mcu=attiny44
attiny44.build.f_cpu=1000000L
attiny44.build.core=arduino:arduino
attiny44.build.variant=tiny14

attiny44-8.name=ATtiny44 (internal 8 MHz clock)
attiny44-8.bootloader.low_fuses=0xe2
attiny44-8.bootloader.high_fuses=0xdf
attiny44-8.bootloader.extended_fuses=0xff
attiny44-8.upload.maximum_size=4096
attiny44-8.build.mcu=attiny44
attiny44-8.build.f_cpu=8000000L
attiny44-8.build.core=arduino:arduino
attiny44-8.build.variant=tiny14

attiny44-20.name=ATtiny44 (external 20 MHz clock)
attiny44-20.bootloader.low_fuses=0xfe
attiny44-20.bootloader.high_fuses=0xdf
attiny44-20.bootloader.extended_fuses=0xff
attiny44-20.upload.maximum_size=4096
attiny44-20.build.mcu=attiny44
attiny44-20.build.f_cpu=20000000L
attiny44-20.build.core=arduino:arduino
attiny44-20.build.variant=tiny14

attiny84.name=ATtiny84 (internal 1 MHz clock)
attiny84.bootloader.low_fuses=0x62
attiny84.bootloader.high_fuses=0xdf
attiny84.bootloader.extended_fuses=0xff
attiny84.upload.maximum_size=8192
attiny84.build.mcu=attiny84
attiny84.build.f_cpu=1000000L
attiny84.build.core=arduino:arduino
attiny84.build.variant=tiny14

attiny84-8.name=ATtiny84 (internal 8 MHz clock)
attiny84-8.bootloader.low_fuses=0xe2
attiny84-8.bootloader.high_fuses=0xdf
attiny84-8.bootloader.extended_fuses=0xff
attiny84-8.upload.maximum_size=8192
attiny84-8.build.mcu=attiny84
attiny84-8.build.f_cpu=8000000L
attiny84-8.build.core=arduino:arduino
attiny84-8.build.variant=tiny14

attiny84-20.name=ATtiny84 (external 20 MHz clock)
attiny84-20.bootloader.low_fuses=0xfe
attiny84-20.bootloader.high_fuses=0xdf
attiny84-20.bootloader.extended_fuses=0xff
attiny84-20.upload.maximum_size=8192
attiny84-20.build.mcu=attiny84
attiny84-20.build.f_cpu=20000000L
attiny84-20.build.core=arduino:arduino
attiny84-20.build.variant=tiny14

attiny13.name=ATtiny13 (internal 9.6 MHz clock)
attiny13.bootloader.low_fuses=0x7a
attiny13.bootloader.high_fuses=0xff
attiny13.upload.maximum_size=1024
attiny13.build.mcu=attiny13
attiny13.build.f_cpu=1000000L
attiny13.build.core=arduino:arduino
attiny13.build.variant=tiny8

Does the builtin arduino core support the tiny13? I know it doesn't with 1.0.6 of the IDE... I haven't used 1.6.0 though, so maybe they added support for it in 1.6.0?

apparantly it does. At least this guy made it work somehow.
http://www.bashmodulo.com/arduino/program-attiny13a-as-standalone-microcontroller/

Jocobes,

If you read the article you are linking to it says:

First, the ATtiny13 core files are needed for proper setup in the Arduino IDE. The ATtiny13 shall be available with quick Google search. Download the ATtiny13A core files and put the ATtiny13 folder inside the hardware folder.

You can use this core:

http://forum.arduino.cc/index.php?topic=89781.0

I believe that's the core I've been using all along. I'll tzry reinstalling everything tho. Will keep you updated

Jocobes:
I believe that's the core I've been using all along. I'll tzry reinstalling everything tho. Will keep you updated

Not according to your boards.txt.

attiny13.build.core=arduino:arduino

See instructions in that thread for creating boards.txt and installing the core. Sadly, that core doesn't include definitions in boards.txt - see the posts in that thread for some instructions.

So I uninstalled my arduino and the first thing I notice was that I was using an old version. So I went on and downloaden + installed the newest version. However, now I cannpt managa to make the attiny show up under the boards menu...