interfacing a atmega32 on a breadboard

Discussion in 'Embedded Systems and Microcontrollers' started by zak9000, Dec 23, 2012.

  1. zak9000

    Thread Starter New Member

    Jan 1, 2012
    20
    0
    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!
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,415
    3,354
    XTAL oscillator?
     
  3. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,669
    804
    How about the other ground pin? You need to connect that as well, and the Avcc and Aref to +5V.
     
  4. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    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.
     
  5. zak9000

    Thread Starter New Member

    Jan 1, 2012
    20
    0
    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...
     
  6. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    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
     
  7. zak9000

    Thread Starter New Member

    Jan 1, 2012
    20
    0
    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?
     
  8. MrChips

    Moderator

    Oct 2, 2009
    12,415
    3,354
    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.
     
  9. absf

    Senior Member

    Dec 29, 2010
    1,490
    371
    Cant you understand what hgmjr have said?

    Allen
     
  10. zak9000

    Thread Starter New Member

    Jan 1, 2012
    20
    0
    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
     
  11. nerdegutta

    Moderator

    Dec 15, 2009
    2,514
    784
    How about pin 30 and 31? No need to connect them?
     
  12. zak9000

    Thread Starter New Member

    Jan 1, 2012
    20
    0
    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..
     
  13. nerdegutta

    Moderator

    Dec 15, 2009
    2,514
    784
    Some comments about the breadboard:


    1. Check polarity of the power intput
    2. Check polarity of the LEDs
     
  14. zak9000

    Thread Starter New Member

    Jan 1, 2012
    20
    0
    checked both still nothing, i am gonna try to change my breadboard next
     
  15. zak9000

    Thread Starter New Member

    Jan 1, 2012
    20
    0
    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
     
  16. zak9000

    Thread Starter New Member

    Jan 1, 2012
    20
    0
    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.
     
Loading...