ATmega32 chip???

Discussion in 'Embedded Systems and Microcontrollers' started by Mathematics!, Mar 16, 2009.

  1. Mathematics!

    Thread Starter Senior Member

    Jul 21, 2008
    Ok, I am having trouble getting my program on the chip.

    The code compiles fine. But I still am a little lost on how to hookup the programmer to the chip.

    I get a red light on the programmer which probably means I didn't set the pin connections correctly.

    I have the programmer ATAVRISP MKII it has a 6 pin connector
    which when I look up the pin out in the data sheet it has

    I know pin one is where the triangle symbol iis on the connector.

    Then All I did is plugged connectors MISO to chips MISO ,...etc etc
    SO it is one to one corospondence.

    But I am confused about how to rig the VCC and ground because their are 2 ground pins on the chip and their are 2 power pins on chip VCC, AVCC

    Plus On AVRFreak they told me I need a battery with the programmer.
    But I thought the programmer programs the chip with the power from the usb port. Didn't think you need a battery to program the chip.

    Either way I am looking thru the data sheet for ATmega32 and I can't find
    What voltages the the chip uses, and what the output voltage oin a pin would be. I need this info so when I do succeed in programming the chip.
    I don't destroy it.

    This is very frustrating because I have everything programmed and ready .
    But I cann't get it on the chip. The datasheet is kind of help full but I cann't find the info I need. I know it's some where in the 346 pages...AAAAAAAAAAAAAAAAAHHHHHH:confused:

    I am currently using programmer connector to the chips 6 - 11 pins.
    But I may need to connect it with pins 30 , 31 ? I am shaky on this .

    I have just read on the first page in tiny bold letters Atmega32 uses 4.5 to 5.5V. Would it be ok to use 3 1.5 volt alkalane batteries in series? Or is their a specific battery you can buy for the chip.

    Thanks for any help.
    I wish I could get this programmer to program the chip I am anxious to get the chip running.

    I am using AVR studio version 4 with WinAvr gcc C programing instead of ASM programming for my IDE.
    Last edited: Mar 16, 2009
  2. hgmjr

    Retired Moderator

    Jan 28, 2005
    Let's get you programming. That's when the fun really starts!!!!

    The red light is there to indicate that the power is present on your target processor and in the proper range. The programmer is not used to power your target processor from your USB port.

    VCC on the programmers connector connects to your target processor's VCC.

    That it true.

    AVCC and AGND are the power and ground connections for the Analog to Digital converter section. When I am not using the ADC, I connect AVCC to the processor's VCC and the AGND to GND.

    Hang in there. Everyone has to have their first encounter.

    Good choice. Those are both great tools.

    If I failed to answer any of your questions let me know.

  3. Mathematics!

    Thread Starter Senior Member

    Jul 21, 2008
    Thanks for your help it was great.

    But I am still unclear about a few things

    So does the programmers connector VCC pin hole connect to the battery power strip on the solderless breadboard and then you run 2 wires also from the power strip on the solderless breadboard to the VCC , AVCC on the chip?

    And then do you run both grounds on the chip to the ground strip on the breadboard ?

    Do you run the rest of the programmers connectors pin holes directly to the chips pins.
    Some thing tells me that reset cann't be riged like
    programmer reset pin ----wire ---chips reset pin.

    But maybe it can however the program connector reset pin hole must be supplying the chips reset pin with 5 volt because I believe it is a reset with a bar (active low)

    Then I would believe you can directly connect the programmers connector MIOS to chips MIOS ...etc with just one wire stuck in the connector and the other end stuck next to the MIOS pin of the chip...etc

    Any thing I am getting wrong????
  4. hgmjr

    Retired Moderator

    Jan 28, 2005
    I recommend that you make your connections between AVCC and VCC on your breadboard.
    Also make your connections between GND and AGND on your breadboard.

    The most straightforward scheme for providing the connection between the atmega32 programming pins and the AVR MKII programmer is to install a 6-pin header (2 rows with 3 pins per row) into your breadboard. One approach to this would be to mount the 2-row by 3-pin header on a small piece of 0.1" by 0.1" gridded vector board and then add two 3-pin single-row headers separated by the distance that will allow you to plug this little adaptor board into your breadboard so that it strattles the ditch that runs down the center of your solderless breadboard. This will provide an ideal place to plug the programmer into your breadboard. You can then add wires between the adaptor board connections and the proper programming pins on the AVR.

    As you may know already, "reset" on the atmega32 is an input and "reset" on the programmer is an output. The programmer reset output is an open collector so all it can do is pull the atmega32's reset pin low. You must provide the recommended 10K pullup resistor between the atmega32's reset pin and its VCC power source for reset to operate properly and allow the programmer to take control over the reset line during programming of the part.

    The connection between the programmer and the atmega32 should be pin for pin. MISO goes to MISO and MOSI goes to MOSI etc, etc, etc.....

    There is one important addition to keep in mind. Atmel recommends that you isolate any of the programming pins like MISO, MOSI, and SCK from any loads to which they are connected by using a series 100 ohm resistor in each line. This precaution is not necessary unless you are using the programming lines in your design. Be sure to connect the programmer's signals lines directly to the atmega32 pin. Don't connect them to the load side of the 100 ohm resistor.

    If you have any concerns and I have confused you rather than made things clearer, I suggest that you draw up your circuit and post it in the thread. I will be happy to take a look at it and provide any comments if anything looks askew.

    Good Luck,
    Last edited: Mar 18, 2009
  5. Mathematics!

    Thread Starter Senior Member

    Jul 21, 2008
    Ok , here is a very rough sketch of what I am doing

    Assume the chip is on the bread board and the holes for the breadboard exist, and the correct voltage battery ...etc

    Can I just connect the 3 programmers lines MISO , MOSI , SCK
    directly to the avr chips 3 pin's (line's MISO , MOSI , SCK) directly.

    Directly meaning putting a wire in the pin holes of the programmer and running the other end of the wire to the vertical row of where the desired chips pin is.

    If this is correct then the only pin I am having trouble with is reset.

    The reset pin of the programmer connect where does it go.
    Ground strip , power strip , or directly to one of the vertical holes common to the chips reset pin?

    Same question but for the chips reset pin?
  6. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    I figured I would consolidate hgmjr's points above to answer your questions, and be a quick reference. :)

    It is frustrating to get the first programming done, after that, it's easy and a LOT of fun! I wish these chips were around when I started... Hang in there!
  7. Mathematics!

    Thread Starter Senior Member

    Jul 21, 2008
    Ok , got how it should go for VCC , MISO , MOSI , SCK , GROUND.

    But for reset

    Ok , So I ran a 10k ohm resistor from the VCC of chip to the reset pin of the chip.

    (For the programmers reset pin hole)
    Now do I plug a wire into the programmers reset pin hole and run it directly to the chips reset pin (i.e one of the empty vertical strip holes common to the chips reset pin on the breadboard.)

    If that is all it is then I am ok.
    I will give this a try when I get home later.

    Seems to me that the programmers reset pin hole doesn't even have to be connected if you manual want to pull one end of the resistor out to reset the chip. Or maybe the programmer needs to be able to reset the chip while programming?

    My other question is since the chip runs on voltages between 4.5 and 5.5
    can I just use 3 AA 1.5 volt batteries in series? I don't see anything about max current rating for the chip or the 1.5 volt AA batteries.
    I am wondering if I am safe in using these?

    Also a battery's voltage may vary a little. So I am wondering how a chip would work if the voltage went from 4.5 to 4.2 ,4.3 ... etc.
    Does the chip have like a built in regulator to give it steady 4.5 volts.
    Or must you use a power supply.

    I am just wondering this because the microchips are like computers on chip. And I know a computer need a power supply feeding it a steady 12 volts dc. If their was a big variation the computer won't work or could be damaged. Even if their was a .5 volt variation that would be a problem.

    Curious to know if their is some sort of built in circuit that does the job of regulating this in the chip.

    Also from your post
    You mean that if I was using the MISO ,..etc pins for input or output pins in my program. Not when actually programming the chip with the programmer. Yes/No ?

    I think you just mean if I was using them after programming the chip then I need to use 100 ohm resistors on each one of those pins that I am using.
    And make sure the load is on one side of the resistor and the chips pin is on the other side.

    Thank you vary much.
  8. hgmjr

    Retired Moderator

    Jan 28, 2005
    Yes. You need to connect the programmer's reset signal to the reset pin on the atmega32. That will result in two things being connected to the reset pin on the atmega32. One end of the 10K will be connected along with the connection to the programmer's reset signal pin.

    It really is that simple.
    You are right on the money with this statement!!!!!
    If you take a close look at the data sheet for the atmega32 you will see that the device can accommodate voltages down in the 2.7V range. There are even versions of some of the AVR's that can operate on voltage down to 1.8V.
    Yes. The reason for the 100 ohm resistor is to prevent the programmer from having to drive a low impedance load (for example a logic gate whose output is connected to one of the programming signal pins of the atmega32) associated with your actual design.
    The programmer's signal line is connected to the end of the 100 ohm resistor that is attached to the atmega32. The load associated with your circuit is connected to the other side of the 100 ohm resistor.

    Once again, I hope I haven't confused you with my attempt to explain the details of connecting the programmer.

    Last edited: Mar 19, 2009