retrointerfacing
  • DIY
    • Arduino
    • fablab
    • fabrication
    • blinky
    • home improvement
    • imaging
    • Processing
    • rapid prototyping
    • recycling
    • repair
  • design
  • robotics
  • retrointerfaces
  • creative technology
  • expo
  • music
  • Home
  • / Arduino /
  • DIY
  • /
  • Robotics
  • /
  • Arduino bootloader for ATmega32

Arduino bootloader for ATmega32

August 25, 2008Arduino, DIY, Roboticsbootloader, Cleaner Robot

The Arduino boards mainly use Atmega8 or ATmega168 controllers. For most of the projects and boards I have been working with in the last years, I have been using mega32 (more memory, more IO). In order to make use of the excellent Arduino resources, making my boards Arduino Compatible seems a logical choice. First thing to do was to rewrite the bootloader. In the following ZIP file you’ll find the modified source (untidied, but working) for an Atmega32 runnning at 16MHz. Also the modified ‘boards.txt’ file that resides in your Arduino hardware directory is in the ZIP. bootloader sources.

The bootloader can be compiled using the makefile in the zip archive, simply typing make in a console (from the correct directory, with correct path settings. I have WINavr as main avr compiler on my system)

In order to make code examples work, a re-mapping of input- and output pins is necessary. IN the discussion on the Arduino forum files where posted with a suggested re-mapping. (unfortunately they didn’t rewrite the bootloader for ATmega32, so I had to do that) I have tested uploading a serial-port example and a simple blinky, using the pin-mapping from AndreS from robotcraft.ca. Their arduino mega32 mapping sources have been posted in above forum. Overwriting the files with same names in hardware/cores/arduino directory does the trick.
I also recompiled bootloaders for other boards with ATmega8 running at 8MHz, see a page on http://www.edwindertien.nl/interactivos/index.html

Unfortunately the bootloader is rather large (2k). For an educational platform (MasterClass robot) we have been using a smaller bootloader (512K) which is AVR911 appnote compatible. (also using AVRdude to do the programming). More on this (mega32) platform can be found on http://www.ce.utwente.nl/e13 in the folder ‘education’.

A newer discussion on avrBootloaders, including the AVRdude commands used are on the wiki.

Comments

mariano February 6, 2009 at 10:50 pm - Reply

esto es posible ?? anda bien ??

    edwin February 9, 2009 at 5:29 pm - Reply

    Sí, trabaja absolutamente bien. Usted necesitará un programador de la ISP del atmel programar al tablero con el cargador de arranque. Apenas transfiera el archivo de cierre relámpago e inténtelo.

SRChiP February 20, 2010 at 1:09 pm - Reply

What is the pin order? (when using to design the pcb)

Is the order PD0 – PD7 –> 0-7
PC0 – PC7 –> 8-15
PB0 – PB7 –> 16-22

PA0 – PA7 –> 0-7 (ADC) ?

Or a different order?

SRChiP March 7, 2010 at 8:14 pm - Reply

Found it.
It’s

PD0 – PD7 –> 0-7
PB0 – PB7 –> 8-15
PC0 – PC7 –> 16-22

PA0 – PA7 –> 0-7 (ADC)

4, 5, 7, 11 seem to be with PWM.

Ryan Dabhi January 2, 2011 at 12:29 pm - Reply

Can you please tell me the fuses for Atmega32 and Atmega16 for 16 MHz crystal.

    edwin March 20, 2011 at 12:41 am - Reply

    Hmm.. couldn’t you just install AVRstudio and copy the settings from there?

Peter May 1, 2011 at 6:42 pm - Reply

I have uploaded the bootloader to my Atmega32 using avrdude. I am now trying to upload a sketch from the arduino IDE via com1 through max232. This dosen’t work. ardunio IDE can’t detect the atmega32.

max232 works for normal serial communications and the DTR is connected to reset via a 0.1uF cap.

Any ideas?

    edwin May 1, 2011 at 9:27 pm - Reply

    Hi Peter,
    Did you also set the fusebits when programming the bootloader using AVRdude? what kind of board-settings (boards.txt) do you use from Arduino IDE?

    Tarun June 13, 2015 at 6:12 am - Reply

    Hi,how do i upload the bootloader to atmega 32 with avrdude?
    i have Usbasp programmer and what should be the pin configuration?

      admin May 10, 2016 at 11:23 am - Reply

      check out my wiki at http://wiki.edwindertien.nl/doku.php?id=software:bootloaders

shahood November 24, 2011 at 4:48 pm - Reply

i want to burn my at mega 32 to the arduino uno board tell me how to boatload my controller

Ashok Srinivasan August 16, 2012 at 5:07 pm - Reply

Dear Edwin,

First of all your page seems to give confidence and a ray of hope to burn the ATmega32 with Arduino framework. As mentioned by you I have some difficulties in understanding certain steps. I wish to know

* I have an USBASP programmer and understand that the makefile needs to be changed with usbasp and the port as usb. Am I rite?

* Now after compiling using the makefile you had provided I have to burn the hex file to the flash of my ATmega32 rite?

* Also the part that is not very clear is the one where you have mentioned about the pin mapping. Should I replace the files in my Arduino software directory with these file you have provided?

Please help me on this.

Thanks and Regards,

Ashok Srinivasan.

andres September 18, 2012 at 1:46 am - Reply

please tell me what version the arduino they are using, on the 022 not run 🙁

Edwin January 9, 2013 at 7:03 pm - Reply

Hi Ashok, You only need to set your USBASP in the makefile if you use makefile to program the chip (as in make program). If you know how to use USBASP with avrdude (the default programmer) you can use the makefile just to compile the hex for the bootloader – and leave the programming to another tool. Even AVRstudio can be used for that.

After compiling using the makefile, the hex file should be programmed first. After that, the mega32 can be programmed using the same serial protocols as for example Arduino is using.

Since in Arduino also an option / structure is included in newer versions to have your own hardware descriptions, I’ll really have to look into an easy way of testing mega32 support for arduino. In fact the controller architecture is similar to the still supported ATmega8.

The pin-mapping should be included or inserted in your arduino environment. This file tells arduino when you use digitalwrite(1,HIGH) which of the hardware pins you have named 1 …

felix January 30, 2013 at 1:49 am - Reply

hello edwin 1 have tested all the digital pin 😀 it works for blinking led and dimming
but can atmega32 use for PWM program and LCD access have you try it?because im try for lcd acces and not work thx maybe you have some sugestion for me

    Tarun June 13, 2015 at 6:18 am - Reply

    Hey,felix how you have burn bootloader on the atmega32,can you please give me step wise guidance so that i can burn boot load the arduino bootloader file to my atmega32.

    Regards,

      admin May 10, 2016 at 11:23 am - Reply

      does the following link help? http://wiki.edwindertien.nl/doku.php?id=software:bootloaders

      admin May 10, 2016 at 11:24 am - Reply

      check out http://wiki.edwindertien.nl/doku.php?id=software:bootloaders — might be a bit outdated since in new arduino versions the hardware- and board definitions are done differently.. I’ll try to do an update sometime soon

felix January 31, 2013 at 5:05 am - Reply

hello edwin can be the analog 0-7 @atmega32 is 0=a0 and 7=a7? for acces at arduino?

JasSingh August 2, 2013 at 11:10 pm - Reply

I want to try something similar to what you described. I have a bunch of ATmega16 & ATmega32 (40-pin DIP), and I want to use Arduino IDE with it, to program them for various projects related to robotics (Like- taking readings from a bunch of sensors, driving DC motors and servos, etc.).

I also have a USBASP programmer (10 pin out, like the one seen here- http://cloud7.lbox.me/images/384×384/201208/usbasp-usbisp-3-3v-5v-avr-programmer-usb-atmega8-atmega128_vmhzyt1346398689726.jpg ) but don’t have access to an Arduino Uno or other boards.

I have the latest Arduino IDE version- 1.0.5
How can I use the Arduino IDE with the ATmega32? I plan on using a 16MHz external crystal oscillator. (is it also possible to use the internal 8MHz clock?)

What files of the IDE need changing? Is there another programmer (hardware) that is better for this? What is the use of FT232RL USB to Serial break-out board from Sparkfun https://www.sparkfun.com/products/718 and is it necessary?

Also, what else do I need (hardware and/or software) to connect the ATmega32 to a computer to
1. upload Arduino sketches onto it, and
2. be able to use the Serial.read and write commands?

I’m new to Arduino so it would be great if you could tell me the step by step process and the necessary hardware pin connections too. Since this is an old post, I was wondering if there have been changes in the IDE that I need to be careful of.
Email me if possible.

Thanks.

dinesh October 26, 2013 at 4:25 pm - Reply

dear edwin,

i’ve compiled the make file but when burning the hex file it shows that it is around 30544 bytes and its too large for atmega32 since it has only 32kb flash and one more thing is it shows error like protocol error expecting 0x14 but resp is 0x51 like that when uploading from arduino. Pls help me.

Patrik October 27, 2013 at 8:22 pm - Reply

Hi Edwin,

great work. Ath the moment I’m trying to get an Atmega32-16PU running. All seems fine, using your postet rtavr.zip.

I’m using an AVRMKII and Arduino 1.0.5. So, if I understand it right, I don’t need a bootloader. The Fuses for the AVR have been set via AVRFuses on Mac. I’m not trying to programm via serial, allthough I have connect a FOCA (FTDI RS232/USB) to get some debugging output.

The only problem I have is that I can’t get SPI communication to work. The goal for the future is to use an Arduino Ethernet Shield or similar. Right now I’m using a simple SDCard-Breakout board which works absolutely fine wiht any Arduino (Mega, Uno, Leonardo, 5V).
While testing SPI the ISP-Programmer is disconnected.

Did you ever get SPI to work with the Arduno environment on an Atmega32? Can’t find any valuable Information though…

Any hints would be very appreciated. Thanks 🙂

Satyavijay July 11, 2014 at 3:27 pm - Reply

Thank you very much for this article on arduino bootloader for ATmega32. I have some queries regarding this-

1. Whether I have to change mfile for compiling according to atmega32?

2. Can I direct program/burn given hex file to atmega32?

Thanks.

Write a Reply or Comment Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Archives

  • November 2017
  • July 2016
  • June 2016
  • July 2015
  • August 2014
  • March 2013
  • December 2012
  • September 2012
  • August 2012
  • June 2012
  • May 2012
  • February 2012
  • January 2012
  • October 2011
  • September 2011
  • May 2011
  • March 2011
  • February 2011
  • October 2010
  • September 2010
  • August 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • September 2009
  • August 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • November 2005

Calendar

January 2026
M T W T F S S
« Nov    
 1234
567891011
12131415161718
19202122232425
262728293031  

Categories

  • Arduino
  • blinky
  • Creative Technology
  • design
  • DIY
  • expo
  • fablab
  • fabrication
  • home improvement
  • imaging
  • music
  • Processing
  • rapid prototyping
  • Raspberry Pi
  • recycling
  • repair
  • retrointerfaces
  • Robotics
  • Uncategorized

Copyright retrointerfacing 2026 | Theme by Theme in Progress | Proudly powered by WordPress