Can't program my ATmega8 no matter what - pictures attached!

Id like to think that I am not an electronics n00b but I can’t for the life of me program an atmega8l-8pu

My makefile is standard other than:

MCU = atmega8

AVRDUDE_PROGRAMMER = stk200 (I am using the AVR-PG2 programmer)

AVRDUDE_PORT = lpt1

Whenever I use avrdude to program the chip I get the infamous:

“make.exe” program

avrdude -p atmega8 -P lpt1 -c stk200 -U flash:w:Testblink.hex

avrdude: AVR device not responding

avrdude: initialization failed, rc=-1

Double check connections and try again, or use -F to override

this check.

avrdude done. Thank you.

make.exe: *** [program] Error 1

AVRStudio4 and Ponyprog won’t connect to my board either (I have used 2 windows XP computers with working parallel ports as I use them for my CNC machines).

My breadboarded circuit is shown below, am I missing something?

http://www.thecadbox.com/images/1.jpg

http://www.thecadbox.com/images/2.jpg

http://www.thecadbox.com/images/3.jpg

Thanks in advance![/img]

that chip’s osc. fuses are set for internal osc. vs. external crystal?

PS: pix too big.

the makefile and .c program were taken directly from http://www.sparkfun.com/commerce/tutori … ials_id=93 so it should be wanting to use the internal osc. Im fine with using the internal osc. if I can get it to work. Otherwise what specifically are my options as the atmega8L version can only run up to 8MHz (making the details found in part 3 of the tutorial not applicable to me). Thanks!

how are the fuses programmed in the chip you are using? If I recall correctly, all fuses are unprogrammed (1) in a “virgin” chip. If the clock source fuse bits are all ones, that corresponds to the choice of external crystal or resonator - which isn’t present in your breadboard (is it?). Or is your chip programmed for internal osc?

From the mega8 datasheet:

Table 2. Device Clocking Options Select(1)

Device Clocking Option CKSEL3…0

External Crystal/Ceramic Resonator 1111 - 1010

External Low-frequency Crystal 1001

External RC Oscillator 1000 - 0101

Calibrated Internal RC Oscillator 0100 - 0001

External Clock 0000

Note: 1. For all fuses “1” means unprogrammed while “0” means programmed.

I do not know yet how the fuses are programmed, my chips are blank so if it is looking for an external crystal/oscillator/resonator how should I set one up? I have 16MHz and 20MHz crystals on hand but like I said the L version of the chip can only run at 8MHz tops. Thanks a ton for your help thus far!

By chance does my answer somewhat lie in post ~5 of this thread? viewtopic.php?t=12789

Im not familiar with AVRDUDE so unfortunately I cant help you.

but damn, thoes are some crisp photos. Might I ask what camera you used? Dont mean to derail this thread!

haha some sub $150 Samsung 5mp from 2 years ago. I thought it sucked but thanks!

kk now back to helping me program this dang thing! it has to be the way the chip is hooked up as it doesn’t matter which program, cable, computer etc. I use it simply fails to recognize

No time to go through it wire by wire, but the second photo shows a yellow wire and a green wire coming from your power and ground rails and attached to nothing at all. Are those just spare parts, or were they meant to do something?

It also looks like the reset button is not connected to the AVR at all.

You might think about cleaning up a little of the rat’s nest with one of these:

http://www.sparkfun.com/commerce/produc … ts_id=8508

Schematic?

Leon

the 1st and 3rd pictures show how my reset button is connected

the green and yellow wires are not connected to anything, there was another component there, I pulled it out and left the wires sit there

the schematic is this, as provided by SFE

http://www.sparkfun.com/commerce/images … ogram3.jpg[/img]

I do not know yet how the fuses are programmed, my chips are blank so if it is looking for an external crystal/oscillator/resonator how should I set one up? I have 16MHz and 20MHz crystals on hand but like I said the L version of the chip can only run at 8MHz tops. Thanks a ton for your help thus far!

Well, as I said above, read the data sheet re the clock source for an unprogrammed chip. You’ll need a crystal.

The default fuses are for the 1 MHz internal clock. Check your reset button - some have internal connections that will hold the chip in reset if they are installed 90 degrees off.

/mike

I have since rewired and changed breadboards and chips…no luck. Anyone have any idea what could be wrong? I doubt its the programmer but that seems to be the only thing left.

I’ve never used a parallel port programmer, but perhaps it does not provide power to your mega8 … many ISP programmers have 5V/GND lines but that’s because they expect to SEE 5V/GND, not provide it. If you haven’t already tried it, connect an external 5V source.

An external power supply is connected (not shown in pictures) as this programmer draws its power from the target board.

I have read on some other sites that you can make a very simple programmer using 2 x 1k resistors and 5 wires directly wired to the pins of a DB25 connector. I am going to try that tomorrow as nothing else is working…

Right, my mistake, it looks like you are giving an external supply.

It might well be your programmer, but the things to try before deciding that are:

  1. Double check that you have made the right connections to your programmer - are you sure you don’t have the pins reversed?

  2. Make sure (with a multimeter) that when you power it up:

There is definitely 5V between the VCC and ground pin

The reset pin is held high (5V)

  1. Since you already have AVRstudio set up, simpler than programming the chip is trying to read the signature byte from it and making sure it matches a mega8.

  2. If you have another mega8 try with that. From the factory they come configured for their internal oscillator, but if you’ve somehow changed the fuse bits it will cease to function without a crystal

  3. If you put LEDs on the MOSI/MISO/SCK pins (with ~500ohm resistors of course) you should see them flicker when the programmer tries to connect. In the absence of a logic analyser this is one way to see if the programmer is at least TRYING to talk to your chip.

Good luck =)

appreciate it big time! i will be sure to try this tomorrow morning, thank you so much!

  1. Double check that you have made the right connections to your programmer - are you sure you don’t have the pins reversed?

ALL CHECKS OUT TO BE GOOD

  1. Make sure (with a multimeter) that when you power it up:

There is definitely 5V between the VCC and ground pin

The reset pin is held high (5V)

5V EVERYWHERE, 2.5V ON RESET PIN WITH 10K PULLUP RESISTOR, TRIED BY REMOVING RESISTOR AS WELL SO CHIP SAW 5V

  1. Since you already have AVRstudio set up, simpler than programming the chip is trying to read the signature byte from it and making sure it matches a mega8.

I GET A SIGNATURE NOT READ RESPONSE

  1. If you have another mega8 try with that. From the factory they come configured for their internal oscillator, but if you’ve somehow changed the fuse bits it will cease to function without a crystal

I HAVE TRIED 4 OTHER CHIPS

  1. If you put LEDs on the MOSI/MISO/SCK pins (with ~500ohm resistors of course) you should see them flicker when the programmer tries to connect. In the absence of a logic analyser this is one way to see if the programmer is at least TRYING to talk to your chip.

LEDs DO NOT BLINK, MUST BE THE PROGRAMMER???

bryank:
5V EVERYWHERE, 2.5V ON RESET PIN WITH 10K PULLUP RESISTOR, TRIED BY REMOVING RESISTOR AS WELL SO CHIP SAW 5V

You should have 5V on the reset pin with pullup in place. Is this with the programmer connected or disconnected? Are you 1000000% sure you’re counting PIN 1 of the programming header correctly?

built a new programmer based on this website [HERE

It too doesn’t work on 2 computers, both with lpt1 ports configured to everything under the sun.

Im 1000000000000000000% sure I have the programmer wired correctly, you can check the pictures on the first page and see so.

When I hook LEDs up to SCK MISO MOSI NOTHING blinks when I try to connect, they just stay on.

I have simply jumped to reset pin to VCC for the time being so to avoid any errors with a switch/resistor/etc.

Anymore ideas before I pay someone to breadboard 2 circuits for me and overnight ship them as this is for a client’s project. Thanks for all of your help thus far](http://images.google.com/imgres?imgurl=http://allintech.info/wp-content/uploads/2008/12/atmega8-1.png&imgrefurl=http://allintech.info/2009/03/programming-avr-parallel-port-ltp/&usg=__x-ANPIvOItJujGzzYTv7iXewOd8=&h=277&w=426&sz=243&hl=en&start=23&sig2=plBnrKST1A9UeQ9fHI6v3Q&um=1&tbnid=pbZHkz03XmeAdM:&tbnh=82&tbnw=126&prev=/images%3Fq%3Dprogramming%2Ban%2Batmega8%26ndsp%3D20%26hl%3Den%26safe%3Doff%26client%3Dfirefox-a%26rls%3Dorg.mozilla:en-US:official%26sa%3DN%26start%3D20%26um%3D1&ei=2-_dSpHKIoXQNNHh3ecN)