Unexpected signature returned to AVRDUDE

I've hooked the Atmega8 based pcb up to an Arduino as detailed in the comments to MegaArduinoISP. When I execute the command line below in AVRDUDE I get the response shown. Something good seems to happen while AVRDUDE and MegaArduinoISP communicate with the target but at the end, AVRDUDE reports that the signature doesn't match an Atmega8. The signature that it reports is for an Atmega328 which is what is on the Arduino I am using as the programmer.

Does anyone know what this means?

pro:~ ejp$ avrdude -P /dev/cu.usbmodem621  -c arduino -p m8 -v -v

avrdude: Version 5.8cvs, compiled on Jan 15 2010 at 17:27:01
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/usr/local/CrossPack-AVR-20100115/etc/avrdude.conf"
         User configuration file is "/Users/ejp/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.usbmodem621
         Using Programmer              : arduino
         AVR Part                      : ATMEGA8
         Chip Erase delay              : 10000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom         4    20   128    0 no        512    4      0  9000  9000 0xff 0xff
           flash         33    10    64    0 yes      8192   64    128  4500  4500 0xff 0x00
           lfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 3.3
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: Expected signature for ATMEGA8 is 1E 93 07
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

pro:~ ejp$

Does anyone know what this means?

It means you are very observant which should make troubleshooting go quickly!

Something good seems to happen while AVRDUDE and MegaArduinoISP communicate with the target but at the end, AVRDUDE reports that the signature doesn't match an Atmega8. The signature that it reports is for an Atmega328 which is what is on the Arduino I am using as the programmer.

AVRDUDE is very likely talking to the Arduino bootloader.

Which Arduino board are you using?

I've had better luck troubleshooting using "stk500" rather than "arduino". Even though it should not, AVRDUDE seems to output different messages. Try this...

avrdude -P /dev/cu.usbmodem621  -c [glow=yellow,2,300]stk500[/glow] -p m8 -v -v

I've hooked the Atmega8 based pcb up to an Arduino as detailed in the comments to MegaArduinoISP.

These comments?
http://www.arduino.cc/playground/Code/MegaISP

Thanks for the quick reply!

AVRDUDE is very likely talking to the Arduino bootloader.

Which Arduino board are you using?

I've had better luck troubleshooting using "stk500" rather than "arduino". Even though it should not, AVRDUDE seems to output different messages. Try this...

avrdude -P /dev/cu.usbmodem621 -c stk500 -p m8 -v -v

I'm using the Freetronics EtherTen. I'll try substituting "stk500".

These comments?
http://www.arduino.cc/playground/Code/MegaISP

Ah, no. The comments from the sketch itself. I see that there are problems involving reset. I'll study the comments and try your other suggestions and get back later.

These are good instructions...

...except that step 1.5 is missing...

1.5 Disable auto-reset. Instructions are available here...
http://www.arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection

...except that step 1.5 is missing...

1.5 Disable auto-reset.  Instructions are available here...
http://www.arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection

Actually, I disabled reset on the target using a 150 Ohm resistor based on the thread where you were helping someone else with a similar problem. I obviously misread what was intended. I don't have a 120 Ohm resistor but I can get one if you think a 150 will not work.

Disabling reset is somewhat hit-and-miss. Some folks swear by the resistor; some by the capacitor.

I can't find a schematic for the board but I found this: "100% Arduino Uno Compatible". A capacitor seems to be the most reliable for the Uno...

Note: this may not work on the Arduino Uno due to differing reset current from the USB chip (see this discussion). For the Uno, connecting a 10?F capacitor between the RESET and GND lines works for me (as described in the linked thread).

Substituting "stk500" returns: "avrdude: stk500_2_ReceiveMessage(): timeout".

The EtherTen uses an ATmega8U2 instead of the FTDI chip just like the new Uno so maybe the cap is the way to go. I'll try that.

With a 10?F cap I get this:

Using Port : /dev/cu.usbmodem621
Using Programmer : arduino
avrdude: stk500_getsync(): not in sync: resp=0xe0

avrdude done. Thank you.

Tried "stk500" with the same results as earlier.

With a -v command?

The output (with -v) should always include the phrase "avrdude: AVR device initialized and ready to accept instructions".

Yes. I only get the verbose output when I don't try to disable Reset. But then I get the wrong signature. I'll try any suggestions you might have including buying a standalone ISP. My other Arduinos are in storage so I can't try one of them.

I have plenty of time and I was going to order a USBtinyISP from Adafruit as soon an they got more stock, which they have.

We haven't considered the fact that my target has a 3.686 MHz clock. I don't know if that matters or not. ArduinoISP uses a clk/128 SPI clock, I believe, so I don't think it's too fast for my target. Thought I'd mention it though.

EmilyJane:
Yes. I only get the verbose output when I don't try to disable Reset. But then I get the wrong signature.

Ugh. Sounds like disabling auto-reset is not working.

I'll try any suggestions you might have

Hmm. If you could install a new bootloader on the EtherTen... but you don't have anything that can act as an ISP to install a bootloader.

I vaguely recall there is a way to disable DTR / RTS in the driver. Some bizarre Linux command. If I remember any details, I'll let you know.

including buying a standalone ISP. I have plenty of time and I was going to order a USBtinyISP from Adafruit as soon an they got more stock, which they have.

A standalone ISP is certainly handy but, if you can get auto-reset disabled nearly any AVR processor will work.

For what it's worth, I really like this one...

(Ironically, the processor is a PIC)

My other Arduinos are in storage so I can't try one of them.

Bummer.

There is a very accessible trace I can cut to disable reset on the EtherTen. I'll try that. It is very easy to reenable with a blob of solder. No biggie.

EmilyJane:
We haven't considered the fact that my target has a 3.686 MHz clock.

Thank you for the reminder. I had forgotten.

I don't know if that matters or not. ArduinoISP uses a clk/128 SPI clock, I believe, so I don't think it's too fast for my target.

I haven't had any problems working with processors clocked at 1 MHz so you should be fine.

Okay, disabling Reset by cutting the trace gives the same "avrdude: stk500_getsync(): not in sync: resp=0xe0" error as before.

Oh rats! You may not have needed to cut the reset trace. I just noticed... you need to set the baud rate (19200). When I get the to the other computer I'll post an example.

Bingo!

         Using Port                    : /dev/cu.usbmodem621
         Using Programmer              : arduino
         Overriding Baud Rate          : 19200
         AVR Part                      : ATMEGA8
         Chip Erase delay              : 10000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom         4    20   128    0 no        512    4      0  9000  9000 0xff 0xff
           flash         33    10    64    0 yes      8192   64    128  4500  4500 0xff 0x00
           lfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x1e9307
avrdude: safemode: lfuse reads as E
avrdude: safemode: hfuse reads as D9

avrdude: safemode: lfuse reads as E
avrdude: safemode: hfuse reads as D9
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Wow! Thanks very much! That wasn't too bad.

Now, I'd like to burn an Arduino boot loader into the Atmega8 so that I can easily play around with some sketches. Later, I'll just burn the code in with avrdude. I'd appreciate some step by step command line instructions to burn the boot loader, a link if that's easier. Then, if I want to use the FTDI serial/USB off my EtherTen to program the Atmega8 and I can't unplug the 328 like with the earlier boards, can I just hold the 328 in reset and parallel the Tx/Rx over to my target?

EmilyJane:
Wow! Thanks very much!

You are welcome!

That wasn't too bad.

Except that your board is now permanently altered (sorry about that). You can always do what Grumpy_Mike did...

Now, I'd like to burn an Arduino boot loader into the Atmega8 so that I can easily play around with some sketches. Later, I'll just burn the code in with avrdude. I'd appreciate some step by step command line instructions to burn the boot loader, a link if that's easier.

For installing bootloaders, I have always used the IDE. Just select an ATmega8 based board and execute Tools / Burn Bootloader / Arduino as ISP.

If you'd like to use the latest and greatest bootloader, go with westfw's version of Optiboot...
http://arduino.cc/forum/index.php/topic,64105.0.html

The hitch-in-your-giddyup is availability. I don't know if he has a ready-made version for the ATmega8. I suspect, if you ask, he will make one.

Or, you can try to build it yourself. Everything you need came with the Arduino IDE.

Then, if I want to use the FTDI serial/USB off my EtherTen to program the Atmega8 and I can't unplug the 328 like with the earlier boards, can I just hold the 328 in reset and parallel the Tx/Rx over to my target?

Yes. Jumper from RESET to GND.

If you're accident prone like me, include a pair of series resistors. I think 220 ohm works and provides a reasonable safety margin.

Okay, I got all that, now, is there a way to back-up the firmware that is currently in the Atmega8? It seems like avrdude can read the flash and the EEPROM but I couldn't quite see what the commands would be. Something with -U I think. :r:filename.hex maybe?

Edit: I found the avrdude pdf so I should be able to figure it out. Still any helpful hints would be appreciated.