atmeg8 progrraming

hello, i try this example(http://ntsdt.net/2009/08/07/programming-an-atmega8-using-arduino/comment-page-1/#comment-399) – but nothing fails – all connections are OK – but when connect Arduino mega, ATMEGA 8 on usb avrdude say:
avrdude -p atmega8 -c avrisp -P com3 -b 19200
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.14s
avrdude: Device signature = 0xffffff
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.

how can I solve this problem? I am using WinAVR-and tries to join the CMD on Win7 – I’ve also tried the win xp

if i try again it say :
avrdude -p atmega8 -c avrisp -P com3 -b 19200
avrdude: stk500_program_enable(): protocol error, expect=0×14, resp=0×50
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude: stk500_disable(): protocol error, expect=0×14, resp=0×51
avrdude done. Thank you.

p.s im using arduino mega

can someone help - what means this error - avrdude: Yikes! Invalid device signature. ?

The avrisp sketch you reference uses the Arduino-side SPI hardware, but that is located on different pins on the Arduino Mega than on the smaller arduinos. You can probably fix this by changing the beginning of the avrisp sketch to:

#define SCK 52
#define MISO 50
#define MOSI 51

And changing the wiring to match.

i change the wiring and code but no change in avrddude …

what this means - avrdude: Yikes! Invalid device signature.?

what this means - avrdude: Yikes! Invalid device signature.?

You can turn on “verbose” mode in avrdude for more information ("-v -v -v -v" is surely enough!)

The device signature is an internal location that the ArduinoISP software reads from the target Atmega8 and passes back to avrdude. It is supposed to be a code that uniquely identifies that type of AVR that you are trying to program. I believe that this is the first command exchange in avrdude that actually attempts to access the target. “Invalid” means the code read (0xffffff in your case) is not recognized as matching any known chip.

What this probably means is that avrdude is talking OK to the Arduino, but the Arduino is NOT talking properly to the atmega8. For example, if I load ArduinoISP into an arduino, but leave all the pins entirely unconnected, avrdude will fail at the same place (only it reports a device signature of 0x000000. If I connect pin 12 to +5V I get the invalid signature 0xFFFFFF.)

The most likely cause is still some sort of wiring error, although I suppose it could also mean that your ATmega8 is broken or improperly configured in some way. This sort of situation where you have many different pieces, none of which you are sure is working right, is very difficult (and annoying) to debug.

It’s a shame that with all the program space on an arduino, it can’t do better diagnostics to give you a clue as to what is going on (I’m not sure this is actually possible, given the nature of the SPI communications between the Arduino and the target, but it might be…)