loading
Hello,

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.

Step 1: A list of that Atmels can be programmed with this and that is needed

Now you know something about that this is about, but you wonder; what MCUs exact can I program using this instructable? First of all, only ATmegas, AT90s or ATtinys. Perhaps some day, PICs to. Or ARM. Or.. Or..
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)

Help please<br>I have some Attiny 26, Atmega 8au and Atmega 2561 au in my hobby box and I can't bootload them using this tutorial. what i got is just a lot of errors during compilation of the sketch. <br>My first question is, for those people who did bootload their atmega chips successful, what is your PC operating system and during that time what version of arduino ide you use?<br><br>Jayson<br> <br><br>
<p>Can anyone tell me how to get a Atmega169PA working?</p><p>I could only find this on <a href="http://www.engbedded.com/fusecalc/" rel="nofollow">http://www.engbedded.com/fusecalc/ </a> :</p><p>low_fuses=0x62<br>high_fuses=0x99<br>extended_fuses=0xFF</p><p>But <a href="http://www.avr-developers.com/" rel="nofollow"> http://www.avr-developers.com/ </a> has not included the Atmega169PA (only Atmega169).</p><p>Can anyone help me please?</p>
<p>Could you tell what changes to make to pin_arduino.h file to program an atmega128 using USBasp programmer.</p><p>I have programmed an atmega32 successfully using arduino ide but in this case the pin_arduino.h file was already available.</p><p>Thank You</p>
<p>Hello!</p><p>I wanna use the third step on atmega32A. Is it possible? and which Crystal (XTAL) shall I use ?</p><p>Thanks for this nice instructables!</p><p>-Prithul</p>
<p>great work... but you haven&rsquo;t solved one problem yet :-) The Arduino IDE doesn&rsquo;t scroll... if your board is below the horizon of the screen in the arduino output, no way to get to it :-)</p>
<p>i like your work dude please keep it up. thanks</p>
<p>hello,</p><p>could you give more information about the bootloader for the at90usb646<br>in Arduino?</p>
<p>The best teachers are the ones who share the gift of knowledge that they have been given with others. You already show the character of a great teacher ...keep up the great work ; it is appreciated !</p><p>Build_it_Bob </p>
thanks sooo much u saved me heart attack:D tought wont work for atmea32
hey boy? does it work on Atmega16??
Super Instructable!!!
What about the new Arduino IDE (vs. &gt;1.0) ?
i was using usbasp with 168 ATMEGA like you said add on the program.txt arduino_attiny2313.upload.using=avrisp so i change lit bit by <br>ATMEGA168.upload.using=usbasp. it works. thanks for great instructable! <br>
It would be fine if you&acute;d said, that the image is an ATtiny2313. To have a better access to this example try to have the pinmapping in a table. <br><br>A great job for a 14 Year old boy!<br><br>themroc
Pin mappings are on the mfr site for the chips, no reason for him to duplicate work for an indestructible with such a wide range of options.
Have you loaded the blink sketch, chose ATtiny2313 board and tried to compile it? <br>It always throws a error for me. Has yours been compiling OK? <br> <br>W
I have been having a lot of trouble getting my computer to get any core files in the IDE. I have tried following this instructable and some others to add core files, but when I save the files to where the preference menu says my sketchbook is in, or even directly into the hardware folder in my arduino file nothing gets added. What could I be doing wrong?
Would it be possible to change the fuses so the chip can use the internal Oscillator?
Yes, but then you would have to change some other things to, otherwise everything timing related (Serial, delay, millis etc. etc.) won't work.
what would i need to change?<br>
I don't know exactly, but probably some things in the boards.txt, and also some of core files, but I couldn't say out of the head what exactly to change.
Another thing, I also tried to flash ATmega32. I chose Penguino Board from the list, as it uses ATmega32 mcu. But the pin mapping of this board is totally messed up. You can find it's pin mapping at <a href="http://wiki.icy.com.au/Documentation/PenguinoAVR/Arduino%20Compatibility">http://wiki.icy.com.au/Documentation/PenguinoAVR/Arduino%20Compatibility</a><br> <br> 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 &quot;boards.txt&quot; or do I also need to add a pin mapping file in the core folder?
I would try to use the available pin mappings. Adding new ones is not just to edit the boards.txt file, you also have to create a set of core files (there you could perhaps use the ones for penguino) and you also have to create the new files for pinmapping. <br> <br>That would be a lot of work, and I don't feel like explaining it. <br> <br>Jan
Please elaborate the pin outs. I am confused. Please make an PDF if possible for convinience.
Some day perhaps, then I have time, much time, but that is a very much work, but I'm working on pinout tables for some normal MCUs, like ATtiny2313 or the ATmegaxx8 family
Nice! Keep it up buddy!<br> <br> Well, I am not able to compile servo program for Atmega16. Do you know how to solve it? It gives me the following errors<br> <br> ..\arduino-0022\libraries\Servo\Servo.cpp: In function 'void initISR(timer16_Sequence_t)':<br> <br> ..\arduino-0022\libraries\Servo\Servo.cpp:159: error: 'TIFR1' was not declared in this scope<br> <br> ..\arduino-0022\libraries\Servo\Servo.cpp:160: error: 'TIMSK1' was not declared in this scope
That is because different MCUs use different register names. The servo library from the Arduino IDE does only work for some MCUs, but for most, it generates errors. <br> <br>I would recommend a google search. I'm sure you will find something.
Hi There,<br><br>If an MCU doen&acute;t appear in your list does that mean it won`'t work or that you haven&acute;t tried yet?<br><br>I&acute;d like to use a AT90PWM (which one exactly I'm not sure yet). you think that would work as the other AT90's?<br><br>Thanks in Advance
The list is taken directly from avr-developers, and it contains the MCUs Mark (and others perhaps) have tested. I can not say anything to the AT90s, as I have never used them myself.
ader.file=ATmegaBOOT.hex<br>arduino_attiny2313.bootloader.unlock_bits=0x3F<br>arduino_attiny2313.bootloader.lock_bits=0x0F<br><br>arduino_attiny2313.build.mcu=attiny2313<br>arduino_attiny2313.build.f_cpu=8000000L<br>arduino_attiny2313.build.core=arduino<br><br>thats wat i got so now wat should i do ???? id idnt understand wat u wrote so help??
Sorry, but I don't really understand that it is you want help with. Perhaps you can specify some more details, like your operating system, the programmer you want to use etc. <br> <br>Jan
i need to upload code to the attiny 2313 frm the arduino!!<br>and one more thing<br>can we just use the normal coding we use for arduino (arduino ide code?)
Yes, the whole idea with this is you can use normal &quot;arduino code&quot; for other MCUs than the ones originally supported by arduino.
hey i downloaded the software the avr developers and then these came<br>bootloader<br>cores<br>firmware<br>.DS_store<br>boards.txt<br>programmers.txt<br><br>after that wat should i do ????
It stands clearly in the instructions.
Fantastic instructable. Two questions:<br><br>Do just the controllers with &quot;USB&quot; or &quot;CAN&quot; in the name have USB or CAN built in respectively?<br><br>What is CAN? <br>
No, basicly the MCUs with USB in the name or ending with u2 or u4 have USB, and the MCUs with CAN in the name have CAN. The best way to find out is looking at the product specs on atmels web site.<br><br>CAN is an industrial producol. Just do a quick google for CAN and you will find all info.<br><br>Jan
what would happen if I didn't connect CTS to ground?
CTS means ClearToSend, and the computer may only send data if this pin is pulled low (to ground). So if you don't you won't be able to send anything.<br><br>But it differs, some computers don't mind CTS, while others do.
I just programmed the bootloader for my atmega8 using the &quot;Arduino NG or older w/ Atmega8&quot;. everything works fine until I upload the sketch. it says &quot;avrdude: stk500_getsync(): not in sync: resp=0x30&quot;. help please? :P
Check what you have the right frequency on the crystal used (if any), and make sure all connections are alright.
I checked everything and everything seems to be okay. I used a generic usb-to-serial cable by the way. is that different from the ftdi cable?
Ok that's the problem.<br><br>Normal serial cables use RS232, while the MCU needs UART/USART. They have different voltage levels.<br><br>Here is a link for a RS232 to UART converter:<br><br>http://t1.gstatic.com/images?q=tbn:ANd9GcSh_CDN4hCsshhcYD41jnXBNYoYY-tbAOW2fnlqWwTKwM6SgKnF (the bottom left part)<br>
http://students.iitk.ac.in/snt/roboclub/Circuits/RS-232-Level-Converter.bmp<br><br>is this a reliable design for a converter?
Yes, but I don't know that the wire from RS232 connecter pin4 to pin6 does.
works like a charm. thanks. but I still need advice.<br><br>before your rs232-uart advice, my working setup was:<br>compile arduino programs into hex files using (https://linvinus.ru/dokuwiki/doku.php?id=robot:arduino_makefile)<br>upload using usbtinyisp<br><br>the advantage of my usbtinyisp setup and disadvantage of the serial connection was:<br>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<br><br>the advantage of the serial/official method, which is the disadvantage of the usbtinyisp/makefile method is:<br>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<br><br>so. is there anything I can do for the resetting dilemma? or the library dilemma?
amazing. I just edited the boards.txt file to use usbtinyisp intead. thanks 02JanDal. nice work
Another way would to hold shift while pressing compile/upload and then finding the path in the output. Go to that path and find the *.hex file. Use that hex file to upload via avrdude.<br><br>But i'm glad it worked,<br>Jan
I heard that pin4 of the rs232 is auto-reset, is that correct? so my only problem now is how to remove the ~8 second waiting time for the program to run. do you have an idea on how to remove this wait time?
can you post a larger picture :p

About This Instructable

89,444 views

159 favorites

License:

Bio: I'm only 14 years old, so don't expect my instructables to be as good as if a 30 year old engineer had done ... More »
More by 02JanDal: Extra inputs for Arduino with a keyboard Arduino on all sorts of Atmels
Add instructable to: