Arduino IDE is designed to program Arduino boards featuring an AVR microcontroller with an Arduino bootloader. But Do you know that the same Arduino IDE can be used to program other Atmega microcontrollers, even without a bootloader?.
Well it can. But you need an extra AVR programmer like USBASP. This method has many advantages like extra program memory space of about 2 Kb due to not using a bootloader, short prototyping time compared to coding in C. Moreover, one need not buy the Arduino board for every project, as we can use the cheaper Atmegas.
I tried Atmega 8 and Atmega 32. Both of them works flawless with the Arduino IDE.The hardware is simple and consists of just the power supply, a crystal (8MHz for atmega 8 and 16MHz for Atmega32 etc. The Atmega to Arduino pin mapping for both of them is given below
The Arduino IDE uploads sketches default using the bootloader and through the serial port. Now we have to change it to the USBASP. This can be done by editing the file named programmers.txt located at ~/arduino-xxx/hardware/arduino directory. We have to add an entry corresponding to our USBASP to the end of the file named programmers.txt.
ie
usbasp.name=usbasp usbasp.communication=usb usbasp.protocol=usbasp
Now we have to edit the file named boards.txt located in the same directory to include our custom boards.We have to add two entries, one for Atmega 8 and the other for Atmega 32. Add the following to the end of Boards.txt
############################################################## atmega32.name=ArduinoMega32 atmega32.upload.using=usbasp atmega32.upload.protocol=usb atmega32.upload.maximum_size=32768 atmega32.upload.speed=38400 atmega32.bootloader.low_fuses=0xff atmega32.bootloader.high_fuses=0xdf atmega32.bootloader.extended_fuses=0x00 atmega32.bootloader.path=atmega atmega32.bootloader.file=ATmegaBOOT.hex atmega32.bootloader.unlock_bits=0x3F atmega32.bootloader.lock_bits=0x0F atmega32.build.mcu=atmega32 atmega32.build.f_cpu=16000000L atmega32.build.core=arduino ################################################################# atmega8.name=ATmega8 @8MHz atmega8.upload.using=usbasp atmega8.upload.protocol=usb atmega8.upload.maximum_size=8192 atmega8.upload.speed=38400 atmega8.bootloader.low_fuses=0xef atmega8.bootloader.high_fuses=0xc4 atmega8.bootloader.path=atmega8_ atmega8.bootloader.file=ATmegaBOOT.hex atmega8.bootloader.unlock_bits=0x3F atmega8.bootloader.lock_bits=0x0F atmega8.build.mcu=atmega8 atmega8.build.f_cpu=8000000L atmega8.build.core=arduino
Now we have to add the some more files. Download this and extract it. Replace the cores directory (~/arduino-xxx/hardware/arduino/cores) with the downloaded folder. Thats all.. you are done. Now you can find two more entries correponding to Atmega 8 and Atmega 32 under your tools>boards option. Select the one of your choice and code…
The code generated using Arduino IDE is much less efficient than the one generated using assembly or even C. It takes more machine cycles to execute. But the main advantage is that the development time of a project will reduce drastically. It is due to the huge number of libraries available for arduino. I built my own versions of Arduino clones on some perf boards and used alot of berg strips. It may feel awkward but it does help very much in rapid prototyping and debugging. below are some photos of my arduino clones.










Using this method is it possible to get the full functionality of ATMega32 ? I mean to say do you get 32 GPIO.
No, I think full functionality of 32 GPIO pins of ATMega32 are not available. We have to sacrifice some pins for the ease of programming in arduino environment
Beautiful clone. But ATMega 32 can be programmed using Arduino ATMega2560? Pin layouts will be different? For your clones why didn’t you use ATMEga328? Are they costly or not available easily. Also what make and from where have you purchased your USBASP also kindly mention protocol and version for the USBASP
i did as u said and uploaded the led blink example on pin 13 and instead of blinking every one second it blinks every 16 seconds im confused .
I feel that you haven’t set up your fuse bits to use the external crystal. The Arduino library assumes that your hardware is running at 16 MHz for Atmega32. While the AVR Microcontrollers are shipped with the default fuse setting of internal oscillator to run at 1 MHz. This explains why your code is running 16 times slower. Update your lfuse settings o use external crystal and everything will be fine
the above procedure is not working. m still getting error of previous deceleration in header file in core directory in compiling code.
Ashi
Hey tried the steps as mentioned , but when I am compiling the code I am getting a “out of scope ” error for all of the regular functions in Arduino IDE
Hello guys,
this link http://ww.thiems.eu/prangelsatz is a project at our university in Germany, Bocholt.
The content is about the Prangelsatz. This is not a real word, so google doesn’t know anything about this, if the project has been started.
After we and our class member implement pages about the Prangelsatz, google recognize this word.
So if you want do some good things, click on the link above and comment what is good or bad on our page.
Greats,
Sebastian