Instructables

Arduino on all sorts of Atmels

Picture of Arduino on all sorts of Atmels
arduinoLogo.jpg
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.
 
Remove these adsRemove these ads by Signing Up
1-40 of 59Next »
pastero0079 days ago

i like your work dude please keep it up. thanks

decsam22 days ago

hello,

could you give more information about the bootloader for the at90usb646
in Arduino?

Build_it_Bob3 months ago

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 !

Build_it_Bob

kamhagh6 months ago
thanks sooo much u saved me heart attack:D tought wont work for atmea32
agargrish6 months ago
hey boy? does it work on Atmega16??
3dotter8 months ago
Super Instructable!!!
3dotter 3dotter8 months ago
What about the new Arduino IDE (vs. >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
ATMEGA168.upload.using=usbasp. it works. thanks for great instructable!
themroc3 years ago
It would be fine if you´d said, that the image is an ATtiny2313. To have a better access to this example try to have the pinmapping in a table.

A great job for a 14 Year old boy!

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.
WWC1 year ago
Have you loaded the blink sketch, chose ATtiny2313 board and tried to compile it?
It always throws a error for me. Has yours been compiling OK?

W
Higgs Boson2 years ago
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?
Lord Fawful2 years ago
Would it be possible to change the fuses so the chip can use the internal Oscillator?
02JanDal (author)  Lord Fawful2 years ago
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?
02JanDal (author)  Lord Fawful2 years ago
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.
sarveshk2 years ago
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 http://wiki.icy.com.au/Documentation/PenguinoAVR/Arduino%20Compatibility

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?
02JanDal (author)  sarveshk2 years ago
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.

That would be a lot of work, and I don't feel like explaining it.

Jan
sarveshk2 years ago
Please elaborate the pin outs. I am confused. Please make an PDF if possible for convinience.
02JanDal (author)  sarveshk2 years ago
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!

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
02JanDal (author)  sarveshk2 years ago
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.

I would recommend a google search. I'm sure you will find something.
Hi There,

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
02JanDal (author)  jekkerdieschmekkerdie2 years ago
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.
francisroan2 years ago
ader.file=ATmegaBOOT.hex
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??
02JanDal (author)  francisroan2 years ago
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.

Jan
francisroan2 years ago
i need to upload code to the attiny 2313 frm the arduino!!
and one more thing
can we just use the normal coding we use for arduino (arduino ide code?)
02JanDal (author)  francisroan2 years ago
Yes, the whole idea with this is you can use normal "arduino code" for other MCUs than the ones originally supported by arduino.
francisroan2 years ago
hey i downloaded the software the avr developers and then these came
bootloader
cores
firmware
.DS_store
boards.txt
programmers.txt

after that wat should i do ????
02JanDal (author)  francisroan2 years ago
It stands clearly in the instructions.
Fantastic instructable. Two questions:

Do just the controllers with "USB" or "CAN" in the name have USB or CAN built in respectively?

What is CAN?
02JanDal (author)  dustinandrews2 years ago
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.

CAN is an industrial producol. Just do a quick google for CAN and you will find all info.

Jan
espert923 years ago
what would happen if I didn't connect CTS to ground?
02JanDal (author)  espert923 years ago
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.

But it differs, some computers don't mind CTS, while others do.
I just programmed the bootloader for my atmega8 using the "Arduino NG or older w/ Atmega8". everything works fine until I upload the sketch. it says "avrdude: stk500_getsync(): not in sync: resp=0x30". help please? :P
02JanDal (author)  espert923 years ago
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?
02JanDal (author)  espert923 years ago
Ok that's the problem.

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)
http://students.iitk.ac.in/snt/roboclub/Circuits/RS-232-Level-Converter.bmp

is this a reliable design for a converter?
02JanDal (author)  espert923 years ago
Yes, but I don't know that the wire from RS232 connecter pin4 to pin6 does.
1-40 of 59Next »