A flock of three ATTiny85's and an ATTiny 2313 with a lone ATMega328 outside. |
There is some text telling you which the name of the chip (ATTiny85) on there, but my camera couldn't pick it up. I tried to edit it for better viewing. |
You have already realized that you can't use the ATTiny chips in Arduino. This is because it doesn't have the cores for the chips. A core in this context is a bunch of code and text that tells Arduino which pins are which, how fast the clock can go, how to upload the program, which functions the chip knows... basically it's an in-depth profile of the chip. I'm going to go over the installation of two cores. The first one is for the ATTiny85. It is the eight-pin chip in the picture.
So first, download this core file: attiny45_85.zip (I got it here. Thanks MIT!) You can unzip it with you favorite unzipping program and look around in it if you want. Now you have to find your Arduino sketchbook folder. You can do this by opening Arduino (I'm assuming you have it) and opening preferences. On a Mac, this can be done by Cmd-Comma. Right at the top should be the words "Sketchbook Location."
Yours will probably not be on the desktop. I moved mine there a while ago. You can change the location with the "Browse" button. |
Hmmm... no hardware folder. Time to make a folder! I think Windows has a hardware folder built in somewhere, but I'm not sure whether the process is the same. My old laptop broke a while ago :'-(. Now, drag the unzipped attiny45_85 folder in to the hardware folder. You should have the same folder tree.
Oooooh, all sorts of fun stuff. |
Reopen Arduino and look in the boards menu. There should be six new boards on there! Three ATTiny45 and three ATTiny85 options. Each has a different programmer. I use "ATtiny85 (w/ Arduino as ISP)" the most, but only because I only have ATTiny85 chips and I haven't bought a dedicated programmer.
EDIT: I just found the comment from Maverick informing me of an important oversight: Arduino 1.0 is a lot different file-wise than the older versions. Files like "WProgram.c" don't necessarily exist anymore. To fix that, Maverick came up with this fix:
- Go to you sketchbook folder (mine's called 'arduinosketchbook', easier to remember)
- Navigate to the /hardware/attiny45_85/cores/attiny45_85/ folder.
- Make a new file called "Arduino.h" and just put this line into it:
#include "WProgram.h"
- From there, just follow the rest of the directions (Restart the IDE, select Arduino as ISP for
programmer...)
Thanks Maverick!
END EDIT
I hope this worked as well for you as it did for me. I will be making post for programming this chip, how to install a ATTiny2313 core, and showing some projects I've used them in.
Great info, thanks very much!
ReplyDeleteIs the process of uploading the arduino bootloader the same as it would be for an ATmega168 / 328?
-Matto
Nope. No bootloader is needed, actually. A bootloader changes how the chip recieves a program, like the Arduino bootloader receives the program over serial. Since this is recieving it over SPI, no bootloader is needed.
ReplyDeleteHey Thatcher,
ReplyDeleteyou wrote that you will make a post about programming the 2312. can you tell me where you got the core files for it?
@gozza - I believe they were from here
ReplyDeletehttp://hci.rwth-aachen.de/luminet
There are certainly others out there, but this one worked great for me.
Hi Thatcher,
ReplyDeleteI got the files from Luminet that you mentioned, but still nothing seems to work for the 2313. I got everything up and running quite well for ATtiny85 & co.
I noticed that the file structure from Luminet is not quite the same as others, i.e. no board.txt file and everything else in a "core" folder. do I need to create these?
Thanks for any suggestions
Sorry for not getting back to you quickly!
DeleteYou could probably try to make one of those paragraphs in boards.txt (it really just says how fast the microcontroller goes, which core to use, and how much memory it has)
Did you check this page? http://toasterbotics.blogspot.com/2011/08/attiny2313-with-arduino.html
So this would, in theory, allow use of the full arduino syntax (external libraries, etc), rather than just the 10-12 default commands? I'm pretty addicted to things like my OneWire and LiquidCrystal_I2C libraries, but also interested in embedding things into smaller chips for installation.
ReplyDeletehi........
ReplyDeletehow can add atmega32 or atmega64 to core supported ide?
Arduino is nice place to begin programming. Tiny AVR support in Atmel Studio 6 would be neat. I had great success following 3-part
ReplyDeletehttp://www.jayconsystems.com/tutorial/atmel/
It gets a compiled CORE.A file from Arduino before it is deleted. He relates how to get the file, copying the location from Arduino IDE build output.
I gained allot from the tutorial, setting it up in Studio 6, using Arduino MEGA2560 and 1.52 latest core build.
Please let me know if you can get the CORE.a file built by Arduino? I came to look for update to this post, possible updated core files. It is not clear whether to build a core using ALL the core files changing only the ones in the ZIP, or to use only the ones in the ZIP.
Am thrilled at new functionality in Studio, and want to get the Attiny CORE working too!
-C