interfacing a atmega32 on a breadboard

Thread Starter

zak9000

Joined Jan 1, 2012
20
hi

i have been programming my atmega32 using a stk500 development board and it has been going fine. however i would like to now move my programmed mcu onto a breadboard. so i started with a simple program to test on a breadboard of a blinking led, the code is shown below:

#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRB |=1 << PINB1;
DDRB |=1 <<PINB0;

while(1)
{
PORTB |=1 << PINB0;
PORTB^=1 << PINB1;
_delay_ms(200);
}
}

the code allows an led on pinb0 to be held high and an led on pinb1 to blink. the code was programmed on my mcu with the stk500 board and then a connector was used on the board to connect to the leds on the stk500 board. once the mcu was programmed it seemed that it was working fine. so i removed the mcu from the socket and connected it to a breadboard with the configuration shown in the image. then i applied a 5V DC supply to the broad but the leds on the breadboard did not light up. after several hours of attempting to make it work i failed to determine what the probelm is. so then i taught maybe the mcu is damaged but when i connected the mcu back into the stk500 board the leds on the pinb0 and pinb1 were acting as they were programmed. i know i am missing something small on my breadboard but not sure what please help!
 

Attachments

hgmjr

Joined Jan 28, 2005
9,027
Just as mrchips has stated, you are missing the crystal on your breadboard. The stk500 provides a crystal for the target CPU when it is plugged into the board.
 

Thread Starter

zak9000

Joined Jan 1, 2012
20
hi
about the oscillator i did connect a simple rc oscillator bettween xtal1 and gnd but still nothing. and about the gnd pin i did also add another connection to gnd but i dont think i need to apply 5v dc to AVCC according to the datasheet i only need to apply 5v if i intead to use portA. so still nothing...
 

t06afre

Joined May 11, 2009
5,934
How about using the Calibrated Internal RC Oscillator. Provides a fixed 1.0, 2.0, 4.0, or 8.0MHz clock. By using this. You should be able to poke your device into life
 

Thread Starter

zak9000

Joined Jan 1, 2012
20
so i put the chip back into the stk500 and programmed it to use its internal oscillator at 1mhz and saw the leds were working as they shoud on the stk500 and so then i connected it back onto the breadboard and still nothing..... what is going on?
 

MrChips

Joined Oct 2, 2009
30,708
Where is the 5V supply for the MCU coming from?
Did you connect the GND to the STK500?
Try your own LEDS and 330Ω series resistor on your breadboard.
 

Thread Starter

zak9000

Joined Jan 1, 2012
20
hi allen

as far as i am aware hgmjr means the stk500 provides an external crystal oscillator for the cpu of the mcu. but from avr studio 5 i have configured the mcu to use its internal default oscillator when my c program is transferred to it. the stk500 does provide a slot to use an external crystal but i have decided to use its internal oscillator.

hi mr chips
my 5v supply is coming from a 5v dc/ 300mA adaptor. i have confirmed that my leds so indeed work. i will take a photo of the configuration on the breadboard and the stk500 so you can see what i am doing
 

Thread Starter

zak9000

Joined Jan 1, 2012
20
i did connect pin 30 and 31 but still nothing anyway attached is three photos i took. photo one has the mcu connected to the stk500 and as you can see it is working fine here as the leds working as they should. photo two is the power supply i am using which is attached to my breadboard and photo three is the mcu configured on the breadboard. maybe you can see if i am doing anything wrong..
 

Attachments

Thread Starter

zak9000

Joined Jan 1, 2012
20
i think i may be on to my problem i measured the voltage delivered to the mcu is 5.8V on the VCC pins from my supposed 5V supply. according to the datasheet it states and acceptable range is 4.5V to 5.5V for VCC so i am gonna give it another go and get back
 

Thread Starter

zak9000

Joined Jan 1, 2012
20
yep the power supply turned out to be the problem. i used a 5v voltage regulator before supplying the mcu and now it works fine.
 
Top