Pages: 1 [2]   Go Down
Author Topic: ATMEGA32A-PU in place of ATMEGA328  (Read 3683 times)
0 Members and 1 Guest are viewing this topic.
Wahiawa, Hawaii
Offline Offline
God Member
*****
Karma: 27
Posts: 582
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1) You need to tell the IDE about it, via the boards.txt file.
a) Create a boards.txt file under \sketches\hardware\mymega32\boards.txt.  (see attach below)
b) Create a pins_arduino.h file under \sketches\hardware\mymega32\variants\mega32\pins_arduino.h.  (see attach below)

2) You need to have some core code support for the AVR.
a) Install the mighty-1284p core under \sketches\hardware\mighty-1284p\ from https://github.com/maniacbug/mighty-1284p

3) You need to make sure the AVR toolchain has support for it.
a) The default AVR toolchain included with Arduino IDE 1.0.5 has support for the ATmega32.  The ATmega32A is a drop in replacement for the ATmega32, with the same signature and fuse settings.

4) You need to make sure avrdude has support for it.
a) The default avrdude v5.11 included with Arduino IDE 1.0.5 has support for the ATmega32.

5) Optional - Create a bootloader for it for serial upload support.
a) The latest Optiboot v5.0a has support for the ATmega32.  https://code.google.com/p/optiboot/downloads/list
b) Note - If you build it for 8MHz use 115,200 BAUD.  The 57600 BAUD setting does not work reliably with Optiboots default double-rate UART setting.
c) For 16MHz external clock:
      > make atmega32 AVR_FREQ=16000000L BAUD_RATE=115200 UART=0 LED=B7 LED_START_FLASHES=3
      (rename optiboot_atmega32.hex to optiboot_atmega32_16MHz.hex)  (see attach below)
   For 8MHz internal/external clock:
      > make atmega32 AVR_FREQ=8000000L BAUD_RATE=115200 UART=0 LED=B7 LED_START_FLASHES=3
      (rename optiboot_atmega32.hex to optiboot_atmega32_8MHz.hex)  (see attach below)
e) copy the bootloader hex files to \sketches\hardware\mymega32\bootloaders\optiboot\


* boards.txt (1.43 KB - downloaded 151 times.)
* pins_arduino.h (4.64 KB - downloaded 148 times.)
* optiboot_atmega32_16MHz.hex (1.32 KB - downloaded 128 times.)
* optiboot_atmega32_8MHz.hex (1.32 KB - downloaded 90 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks!!!  smiley-lol
This is exactly what I was looking for!
I will post results as soon as I get it done. One more query though, I will use the "upload using programmer" function as I don't need the serial interface. I have an usbasp. It will work, right?  smiley-razz
Logged

Wahiawa, Hawaii
Offline Offline
God Member
*****
Karma: 27
Posts: 582
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, that should be okay.  Just remember to burn bootloader at least once, to get the fuses set.  Or you could also do it manually from command line with avrdude.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The ATmega32A is a drop in replacement for the ATmega32, with the same signature and fuse settings.

The default fuse settings are different for the 32 and the 32A.
Atmega 32:
HIGH FUSE: 0x99
LOW FUSE: 0xE1

Atmega 32A
HIGH FUSE: 0x99
LOW FUSE: 0xF1

Where do I change these? Would a change in the boards.txt file suffice?
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1422
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@lastRites:

Your sanity would be preserved if you elected to not jump into deep water until you can swim.  Try starting with a board'duio based on a cheap 328P-PU.  The Chips are cheap, the Internet has numerous and easy to follow directions, and you can use your existing Arduino as an ISP.

Example: http://www.gammon.com.au/forum/?id=11637

After you master the backstroke, then move on to the more complicated.


- Ray
« Last Edit: July 06, 2013, 08:24:43 am by mrburnette » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If using the 328 was an option for me, I would have got it smiley-razz I can only get the ATMEGA32A-PU and atmega8l-8pu. So I have to disregard my sanity  smiley-grin
Thank you for the suggestion though smiley
Logged

Wahiawa, Hawaii
Offline Offline
God Member
*****
Karma: 27
Posts: 582
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The default fuse settings are different for the 32 and the 32A.
Atmega 32:
HIGH FUSE: 0x99
LOW FUSE: 0xE1

Atmega 32A
HIGH FUSE: 0x99
LOW FUSE: 0xF1

Where do I change these? Would a change in the boards.txt file suffice?

Yes, changing them in the boards.txt will do as long as you use the IDE and burn bootloader to use these values.
Note: the fusecalculator for the 32A is faulty.  Just use the one for the 32.  They should be the same.

Since you are not using the bootloader, I would recommend high fuse 0xDF or 0xD7 depending on whether you want to save the EEPROM data when burning bootloader.

« Last Edit: July 06, 2013, 02:56:42 pm by hiduino » Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 57
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can see if you can program the atmega32a with standard arduino. Plus, atmega328 are cheap on digikey, but they charge $10 SHIPPING. So go to Jameco, or ebay. Just a little hit where to look for your next part your going to buy. Good Luck!
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 106
Posts: 6367
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I can only get the ATMEGA32A-PU and atmega8l-8pu
You'll have an easier time getting the atmega8l-8pu working.  That's essentially identical to the atmega8, which was the chip used on original ancient Arduinos.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks hiduino, very helpful.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hiduino
I'm not sure, so I have question. I have got USBasp programmer. If I complete Your instruction, could I run with atmega32a?

the next problem.
Quote
a) Install the mighty-1284p core under \sketches\hardware\mighty-1284p\ from https://github.com/maniacbug/mighty-1284p
I can't open this link
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i used another web browser, and I Installed the mighty-1284p core

but, still it does'n work.

after burning bootloader I had warnings with slow sck (i had it too with atmega8, but it wasn't a problem, becoause atmega8 works fine)
after compiling code and sending it into atmega32, I had avrdude error.

maybe, becoause I don't understeand where I should I change:
Quote
5) Optional - Create a bootloader for it for serial upload support.
a) The latest Optiboot v5.0a has support for the ATmega32.  https://code.google.com/p/optiboot/downloads/list
b) Note - If you build it for 8MHz use 115,200 BAUD.  The 57600 BAUD setting does not work reliably with Optiboots default double-rate UART setting.
c) For 16MHz external clock:
      > make atmega32 AVR_FREQ=16000000L BAUD_RATE=115200 UART=0 LED=B7 LED_START_FLASHES=3
      (rename optiboot_atmega32.hex to optiboot_atmega32_16MHz.hex)  (see attach below)
   For 8MHz internal/external clock:
      > make atmega32 AVR_FREQ=8000000L BAUD_RATE=115200 UART=0 LED=B7 LED_START_FLASHES=3
      (rename optiboot_atmega32.hex to optiboot_atmega32_8MHz.hex)  (see attach below)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset



* Bez tytułu.jpg (313.59 KB, 1280x800 - viewed 91 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

finally I have found this link
https://github.com/eaconner/ATmega32-Arduino

It is working with Arduino IDE 1.0.5 with my USPASP

but... I had some problems with SPI library, because of MISO MOSI SCK pins, so I changed numbers of pins in SPI.cpp library
Logged

Pages: 1 [2]   Go Up
Jump to: