Installing Attiny13 Core Files

32,702

33

54

Published

Introduction: Installing Attiny13 Core Files

About: I am a physician by trade. After a career in the pharmeceutical world I decided to take it a bit slower and do things I like. Other than my hobbies that involves grassroots medicine in S.E.&P Asia. I have bu...

In an instructable "Make an Attiny13 based IR proximity sensor for $2.42" by Dustin Andrews refers to having to install the Attiny13 core files.

Unfortunately the core files that are linked to do not contain the boards.txt file that will let the Attiny 13 show up as choice under 'Tools-boards' in the IDE. If you are a novice at installing core files this may seem daunting, but since I just did it, I thought I'd just share that knowledge with you.

Do the following:
-Download the Attiny cores from: http://sourceforge.net/projects/ard-core13/
-Go to your sketches folder
-most likely there is a folder called 'hardware' if not, create that.
-open the hardware folder
-create a folder called 'attiny13'
-open that folder
-create a folder called cores
-open that folder
-create a new folder called 'core13'
-so now you have the structure /hardware/attiny13/cores/core13
-open that deepest folder and unzip the attiny core files to that folder
-go back to your /hardware/attiny13 folder
-create a text file called 'boards.txt'
open that file.
paste the following text in that file:

###########################################################################
attiny13int.name=Attiny13 @ 128 KHz (internal watchdog oscillator)
attiny13int.upload.using=arduino:arduinoisp
attiny13int.upload.maximum_size=1024
attiny13int.upload.speed=250 # important for not losing connection to a slow processor
attiny13int.bootloader.low_fuses=0x7B
attiny13int.bootloader.high_fuses=0xFF
attiny13int.bootloader.unlock_bits=0x3F
attiny13int.bootloader.lock_bits=0x3F
attiny13int.build.mcu=attiny13
attiny13int.build.f_cpu=128000
attiny13int.build.core=core13

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

attiny13at4.name=ATtiny13 @ 4.8MHz (internal 4.8 MHz clock)
attiny13at4.upload.using=arduino:arduinoisp
attiny13at4.bootloader.low_fuses=0x69
attiny13at4.bootloader.high_fuses=0xff
attiny13at4.upload.maximum_size=1024
attiny13at4.build.mcu=attiny13
attiny13at4.build.f_cpu=600000
attiny13at4.build.core=core13
###############################################################

attiny13.name=ATtiny13 @ 9.6MHz (interne 9.6 MHz clock)
attiny13.upload.using=arduino:arduinoisp
attiny13.bootloader.low_fuses=0x7a
attiny13.bootloader.high_fuses=0xff
attiny13.upload.maximum_size=1024
attiny13.build.mcu=attiny13
attiny13.build.f_cpu=1200000
attiny13.build.core=core13
###############################################################

I got this 'boards.txt' file from here, but had to adapt it a little as that file 'sneekishly' suddenly changes the programmer in its last definition and also I had big trouble getting more than 2 boards to show up, until I realised that 2 of the board definitions carried the same name, so I had to change that as well. Also, the names of the boards are not entirely correct. The fuses on the 4.8 MHz board are 0x69 and 0xFF. That indicates that the prescaler is already set to division by eight, which corresponds with the f_cpu of 600.000.
For the 9.6MHz internal clock board, we see that the fuses 0x7a and 0xFF are in fact correct for 9.6MHz without prescaler, but then the f_cpu of 1200.000 is not correct, that points to a division by 8 for which the fuses should be 0x6A and 0xFF. However, i didnt mess with that and everything worked fine, but the timings might be off.
You may want to adapt your boards.txt file once you have it all installed to reflect the true settings. Also, you will not find the 128kHz setting very useful and the danger is that you may not be able to communicate with your chip anymore because it becomes too slow

So, just as a final check that you have done everything right:
Go to your hardware folderYou should see a folder there called attiny13
Open that folder
It should have 2 entries: a folder called 'cores' and a text file called 'boards.txt'
open the folder 'cores'
That should have one entry: a folder called 'core13'
open 'core13'. There you should find 13 files with 'h', 'c' and 'cpp' extensions.

To make it easy I made a zip file that should unpack with the right directory structure. Unzip it in the 'hardware' folder.

Update for IDE 1.6.x The zip file installs correct for the 1.0.6 IDE. For the IDE 1.6.x see my reply to Danny-dan in the comments, or look in the article : Installing Attiny13 core in 1.6.x and 1.7,x IDE

As an added note: in 2015 when i wanted to program some Attiny13's, seemingly i had screwed up my installation and I couldnt program the chips anymore. Apparently I had forgotten I wrote this ibble. A search found my own ibble and when i installed the zip file... everything went like clockwork again.

Share

Recommendations

  • Casting Contest

    Casting Contest
  • Planter Challenge

    Planter Challenge
  • Make it Move Contest

    Make it Move Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

54 Comments

hello , thanks for this but, i cant use the instruction "if" with attiny13 in ide arduino

1 reply

I am using Arduino as ISP
ArduinoISP Sketch is uploaded to UNO's Atmega Chip

then Selected board ATTINY13 internal oscillator.

Selected Programmer > Arduino as ISP

Open the Blink program for ATtiny13 where pin0 is set for output as shown in picture.

when click upload. it gives me following error. Help please.

Capture.PNG
16 replies

the first error about PAGEL and BS you can just ignore.
The 2nd error can mean a lot, e.g. that you do not have your connections right, but it can alos mean that somehow some unwanted fuses were set that make your chip unprogrammable via ISP.
so just a few questions:
are you sure you made all the right connections in your programmer.
Are you sure it is an Attiny13?
Is that a new attiny or has it been used before

Well Hello Again (^_^) !
It has bee a long time.

I am just trying to connect a RF 433 MHz Module with ATtiny13 and got no luck. actually I tried all libraries available for this module, but all of them failed to compile with ATtiny13 board. the shortest path to the solution I found is that, Manchester library work at 8MHz, 16MHz or with AT328P chip, while ATtine13 runs at 9.6Mhz, so I want to run tiny13 with a External Oscillator I am hopping it will work. any suggestion about attaching an external oscillator ? am I going in right direction ?

Thank you again :) !

The attiny13 is the only device in the AVR family that doesn't accept a crystal input directly.

The simplest approach to a stable external clock for a
microcontroller is to use a crystal clock generator IC. These are
IC-sized metal boxes that put out a precision clock signal +5<>0
with +5 VCC. They are available in a wide range of frequencies.

Another approach is to find a stable clock source from another part
of your application circuit and feed that signal into the Tiny13.
Either way you need to use the Tiny13 timer to count down the input
clock pulses to get precise real-time intervals like 1/10 second.

You can make a crystal oscillator by using TTL invertor chips like
the 74HC04 or inverting NAND or NOR gates. The crystal is attached
across the input and output of the gate. Usually a few small value
capacitors are added to start the oscillation and stablize the circuit.
There are circuits available on the web.

If you want to use the Tiny13 and not have all the overhead of
external circuitry for an external clock, then use the OSCCAL register
as another responder has suggested.
Store the adjusted OSCCAL value in the Tiny13 EEPROM and load it at
power-up/reset.

Having said that all. You want to have an oscillator for a chip that doesnt really accept an oscillator to use a library that otherwise doesnt support the chip.
Now I am all for trying but why on earth would you want to do that if you can use an attiny 25/45/85 without all the fuss

I get that. The problem is I can't get the 85/45 etc chip. the hobby shop doesn't have these chip I asked to place order for 85 chip, but I don't know he is lazy or what. and that is the only hobby/electronic parts shop in my town. so I am just searching how far the chip can be pushed. I apologize if i bother you too much. but you are an expert. amd I cant thank enough for the words of help form you... so Thank you again !

how about aliexpress.com

:D I know about aliexpress, Alibaba etc. the truth is that I don't have mater card to order that :D so I asked shop keeper to do it for me. but he is not doing it so.

I was Google-ing since then, and have decided to go other town to buy 85 or 2313. till then. I am trying to make an external clock source (I know tiny13 is limited but I just want to make that).

in one of my other replies I pointed out a manchester program that works with the attiny13. Best try that then

@diy_bloke, Thank you for your quick reply.

Yes the Chip is new, actually it is my first time that I am trying to upload program into ATTINY chip, and failing since the first time I tried to upload. and about connections, the chip is connected as follows:

ATTINY13 || Arduino UNO

pin 1 (reset) = 10

pin 4 (GND) = GND

pin 5 (SCK) = 11

pin 6 (MISO) = 12

pin 7 (MOSI) = 13

pin 8 (Vcc) = 5v

A 10uf capacitor (-) side to GND of arduino and (+) to Reset

attiny-ispx5_bb.png

read my earlier reply as well, but maybe you have your sequence wrong and you are trying to upload to your UNO.
Make sure you have the ISP uploades to UNO
then attach your Attinyprogrammer
Then select Attiny13 under 'tools make sure you have Arduino as ISP selected.
Go to file and select
'Upload using Programmer"

Sorry But I guess there is some miss understanding :)

actually I just want to burn boot loader to attiny (if it is necessary) to make it arduino compatible.for this purpose, I am uploading ArduinoISP sketch to my Arduino UNO board to use UNO as ISP for ATTINY. but the problem is that I am unable to uplaod any program to it.

I see and I think I know where the problem is. What bootloader did you upload to the Attiny13?
As far as I know there is no bootloader for the Attiny13. If you just clicked the option "Tools- Burn Bootloader", The only thing that happens is that it sets some fuses that define some characteristics of the Attiny, like what the oscillator speed is.
It is not that it suddenly has a bootloader that will upload programs. For that you just have to use "File-Upload Using Programmer"

So, again.. what you do is to laod the ISP in your UNO, connect the progarmming circuit (did you include the resistor in your circuit to prevent resetting?)
Then you choose "Tools-board-Attiny13-9.6MHz" (or 4.8 or whatever) and you then choose 'Burn bootloader"
As I explained, that doesnt burn a bootloader, it just sets fuses to tell the attiny it is 9.6 MHz (in this case).
Then you load the program you want into yr attiny13 in the IDE and you go to Files-Upload using programmer"
Done

Well thank you again diy_bloke !

okay it seems I have bricked my ATtiny13. Not a big issue , I'll buy new one :)
but I have a question, do ATtiny really need boot loader ? I mean can I directly upload program again and again using Arduino IDE ?? like ATMEGA 328.

Thank you again. I will again perform these steps as you directed then I will post the results.

you really should read my replies as I explained that already.
There is no bootloader for the Attiny13.
you upload programs through ISP using "Files upload using programmer"

"burning the bootloader" only sets fuses, it doesnt put a bootloader in the chip as there is no bootloader.
Just follow the steps as i described

I see you have the capacitor in yr circuit so there is no need for a resistor

Make sure you read all my answers: with regard to tyhe 'Yikes' error message. If you have burned a bootloader, thinking you needed to burn the UNO bootloader, you have burnt some unexpected fuses in your Attiny13. And therefore it isnt properly recognized. So if your problem persists and you have checked all your connections and settings, you have most likely bricked your Attiny13.
need a HV programmer to set them back to factory values.
If you have more than one Attiny13, I suggest you take a fresh one and follow my instructions on what to do to the letter (make sure you read all 3 replies I gave you). If you only have one Attiny13, you must first unbrick it

No I have just read few of them. Sorry for that. I will read them first then I'll ask you the next question.
Thanks.

Hello,

thanks for the post, i am having some errors :

"exec: "-w": executable file not found in %PATH&"

Please any help???????

Cheers