this is my first instructable, so I hope someone can do anything good with it.
So, what exactly is this about?
Imagine: You are working on a project. You want to program in the Arduino language because of the simplicy. But you don't want to use a 28 pin monster. Or you need peripherals like CAN or similar what the normal Arduino supported MCUs don't have. So, what to do? Where are two alternatives:
1. Just don't use the Arduino language and use things like bits and ports what you can't understand.
2. Or continue reading this!
So, this instructable is going to show how to use the core files available from avr-developers.com. I'm also going to show you how to program the different MCUs and how to connect them to do so. At the end I'm going to give some ideas on what you can to with your new knowledge earned from this.
As a little side note I want to say something; I'm just 14 years old, so please, if something is not as good as if an 40 year old engineer had done it, have mercy, write a comment about it and I will try to fix it.
If you have any problems, feel free to post a comment or drop me an email (jan[at]dalheimer[dot]de). If you can't figure out what to use instead of the [at] and [dot], I don't want an email from you.
I just saw that some MCUs use the ArduinoISP as default and some use the USBtinyISP as default. To see how to change, see step 5.
I want to say a big thank you to Mark Sproul for the modified core files at avr-developers.com. THANK YOU!
So.... Let's get started!
IMPORTANT: I give no warranty in any way for anything in this instructable. Some names like Atmel, ATmega etc. belong to their owners. Also almost all pictures do NOT belong to me.
Remove these ads by
Signing UpStep 1: A list of that Atmels can be programmed with this and that is needed
But for now, just MCUs from Atmel.
The frequency for each MCU can be found by choosing your MCU here, opening up the boards.txt file and then searching for your MCU. There will then stand yourBoard.bootloader.low_fuses=fuse and yourBoard.bootloader.high_fuses=fuse. Then copy the number that stands instead of fuse into the fields at the bottom of the page. Click "Apply Values" and then you can see what type and speed of crystal to use in the drop down menu further up on the page.
To find out that type of upload you should use, go to the AVR developers page and look that stands there.
So, here is a list of working MCUs, sorted by type and number:
Name:
== ATmega:
ATmega8
ATmega8u2
ATmega16
ATmega32
ATmega32u4
ATmega48
ATmega64
ATmega88P
ATmega128
ATmega128rfa1
ATmega165
ATmega165P
ATmega168
ATmega169
ATmega324P
ATmega328P
ATmega640
ATmega644
ATmega644P
ATmega645
ATmega1280
ATmega1281
ATmega1284P
ATmega2560
ATmega2561
ATmega3290P
ATmega8515
ATmega8535
== ATtiny:
ATtiny26
ATtiny45
ATtiny85
ATtiny2313
== Others:
AT90CAN128
AT90CAN32
AT90CAN64
AT90USB1286
AT90USB1287
AT90USB162
AT90USB646
AT90USB647
Now you know what MCUs you will be able to program with this. But what do you need?
1. An ISP programmer. This instructable will use an Arduino as ISP, but I will add a category on how you can use other ISP programmers at the end of the instructable.
2. An USB <-> Serial converter or an RS232 <-> UART converter (only needed for programming MCUs with bootloader).
3. An breadboard. You can also solder on a perfboard or a custom PCB, but that is up to you and will not be covered here.
4. An computer. (I think you have one, otherwise you couldn't read this :))
5. The Arduino program. It can be downloaded from here .
6. The core files available at avr-developers.com . See the next step for how to install it right.
7. The MCU to program.
8. Some really cool idea on that you want to do after reading this. (Optional, but recommend)









































Visit Our Store »
Go Pro Today »




A great job for a 14 Year old boy!
themroc
It always throws a error for me. Has yours been compiling OK?
W
I wish to add another board for ATmega32 with std pin mapping as shown in this instructable. How can do that? Do I just have to add another board profile in "boards.txt" or do I also need to add a pin mapping file in the core folder?
That would be a lot of work, and I don't feel like explaining it.
Jan
Well, I am not able to compile servo program for Atmega16. Do you know how to solve it? It gives me the following errors
..\arduino-0022\libraries\Servo\Servo.cpp: In function 'void initISR(timer16_Sequence_t)':
..\arduino-0022\libraries\Servo\Servo.cpp:159: error: 'TIFR1' was not declared in this scope
..\arduino-0022\libraries\Servo\Servo.cpp:160: error: 'TIMSK1' was not declared in this scope
I would recommend a google search. I'm sure you will find something.
If an MCU doen´t appear in your list does that mean it won`'t work or that you haven´t tried yet?
I´d like to use a AT90PWM (which one exactly I'm not sure yet). you think that would work as the other AT90's?
Thanks in Advance
arduino_attiny2313.bootloader.unlock_bits=0x3F
arduino_attiny2313.bootloader.lock_bits=0x0F
arduino_attiny2313.build.mcu=attiny2313
arduino_attiny2313.build.f_cpu=8000000L
arduino_attiny2313.build.core=arduino
thats wat i got so now wat should i do ???? id idnt understand wat u wrote so help??
Jan
and one more thing
can we just use the normal coding we use for arduino (arduino ide code?)
bootloader
cores
firmware
.DS_store
boards.txt
programmers.txt
after that wat should i do ????
Do just the controllers with "USB" or "CAN" in the name have USB or CAN built in respectively?
What is CAN?
CAN is an industrial producol. Just do a quick google for CAN and you will find all info.
Jan
But it differs, some computers don't mind CTS, while others do.
Normal serial cables use RS232, while the MCU needs UART/USART. They have different voltage levels.
Here is a link for a RS232 to UART converter:
http://t1.gstatic.com/images?q=tbn:ANd9GcSh_CDN4hCsshhcYD41jnXBNYoYY-tbAOW2fnlqWwTKwM6SgKnF (the bottom left part)
is this a reliable design for a converter?
before your rs232-uart advice, my working setup was:
compile arduino programs into hex files using (https://linvinus.ru/dokuwiki/doku.php?id=robot:arduino_makefile)
upload using usbtinyisp
the advantage of my usbtinyisp setup and disadvantage of the serial connection was:
no need to press reset button, and program runs right after programming,( unlike for the serial connection, program runs around 8 seconds after hitting reset, and reset needs to pressed before uploading
the advantage of the serial/official method, which is the disadvantage of the usbtinyisp/makefile method is:
all library files are used in compiling using the original IDE. unlike for my makefile which doesn't include certain libraries. also the original IDE works as planned in both linux and windows
so. is there anything I can do for the resetting dilemma? or the library dilemma?
But i'm glad it worked,
Jan
Please be careful taking images from other sources (Atmel-Logo etc.) I don´t know the law for sure, but I think they are not free too use).
You are a really smart boy, but consider the reader is not as smart as you. Some steps need a little bit more Explanation. Try to explain Step by Step in an example (ATtiny2313 or other).
themroc
2. Quote: You mean, finding the MCU and changing the programmer-option?
Please explain it.
??? Please explain more about what you mean.
3. Quote: It would be fine if you´d said, that the image is an ATtiny2313.
If you hower over the yellow field you will see that the image is an ATtiny2313.
4. I've asked for permission for all of the images.
5. I've already thought about making a step-by-step for one AVR, but I haven't came to that yet, especially since my only ATtiny2313 has the reset disabled (wrong fuse...) and I've been waiting for more AVR's to come, but I live in Sweden and some times packages get totaly lost for some mounths.
JanD
If you have the permission for the images ok.
Sorry in my version of this instructable the yellow fields in Step 6 only show the pins not the MCU.
If you need a Attiny2313, I´ll send you two (under 20g).
Themroc