I am just starting out trying to program ATMEL's ATMEGA32A-PU microcontroller using my arduino uno R3 as the ISP programmer. I was following the tutorial found here: http://hackaday.com/2010/10/23/avr-programming-introduction/
This tutorial describes programming an ATMEGA168 chip. I looked up the datasheet for the ATMEGA32 and adjusted the wiring, I believe, correctly and I'm using avrdude to program the chip.
I am running Windows 10 x64. I downloaded WinAVR-20100110.
From the hackaday instructions I loaded my arduino with the ArduinoISP sketch from FILE->examples in the arduino IDE. I made no changes.
The pins on the atmega32 chip are connected thus:
6 (MOSI) to arduino 11
7 (MISO) to arduino 12
8 (SCK) to arduino 13
9 (RST) to arduino 10
10 (VCC) to 5v
11 (GND) to GND
30 (AVCC) to 5v
31 (GND) to GND
I am using the arduino's 5v and GND pins to supply power and ground to the AVR.
From a cmd prompt I am running: avrdude -v -P COM3 -b 19200 -c avrisp -p atmega32 -U flash:w:main.hex
avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"
Using Port : COM3
Using Programmer : avrisp
Overriding Baud Rate : 19200
AVR Part : ATMEGA32
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 4 10 64 0 no 1024 4 0 9000 9000 0xff 0xff
flash 33 6 64 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00
lock 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
calibration 0 0 0 0 no 4 0 0 0 0 0x00 0x00
Programmer Type : STK500
Description : Atmel AVR ISP
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.06s
avrdude: Device signature = 0x1e9502
avrdude: safemode: lfuse reads as E1
avrdude: safemode: hfuse reads as 99
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "main.hex"
avrdude: input file main.hex auto detected as Intel Hex
avrdude: writing flash (144 bytes):
Writing | ################################################## | 100% 0.22s
avrdude: 144 bytes of flash written
avrdude: verifying flash memory against main.hex:
avrdude: load data flash data from input file main.hex:
avrdude: input file main.hex auto detected as Intel Hex
avrdude: input file main.hex contains 144 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.12s
avrdude: verifying ...
avrdude: 144 bytes of flash verified
avrdude: safemode: lfuse reads as E1
avrdude: safemode: hfuse reads as 99
avrdude: safemode: Fuses OK
avrdude done. Thank you.
It goes through the programming and says it succesfully wrote 144 bytes. I've also tried using stk500 since the output of the command above mentions it but I get a timeout error when I do that. For testing purposes all I'm trying to do is get 8 LED's from PORTD to light up. I'm including avr/io.h and
int main(void)
{
DDRD |= 0xff; //Set PortD Pins as an output
PORTD |= 0xff; //Set PortD Pins high to turn on LEDs
while(1) { } //Loop forever
}
Unfortunately, PD1 is the only led to light up. None of the rest do anything.
I have the microcontroller connected to a breadboard with pins 14-21 each connected to its own 470 ohm resistor. The resistors each connects to its own LED which then connects to ground.