arduino as isp random issues

Hi,
I am trying to upload bootloader using arduino isp as programmer. it is giving random issues:

  1. some times it reads random device signature
  2. sometimes it reads correct signature but not able to read fuse bit. e.g., the 3rd safemode read operation of fails
  3. device signature is mostly 0x000000, but different values are also coming.
  4. sometimes everything goes fine but at the end during verify mismatch occurs at random position.
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xff != 0x00
avrdude: verification error; content mismatch
avrdude: Send: Q [51]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 

avrdude done.  Thank you.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.08s

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

avrdude done.  Thank you.
G:\debojit\electronics project\arduino-1.0.4-windows\arduino-1.0.4\hardware\tools\avr\bin>avrdude -C ..\etc\avrdude.conf -v -v -v -p atmega8 -c stk500v1 -P \\.\COM2 -b 19200

avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "..\etc\avrdude.conf"

         Using Port                    : \\.\COM2
         Using Programmer              : stk500v1
         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
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         33    10    64    0 yes      8192   64    128  4500  4500 0xff 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         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.09s

avrdude: Device signature = 0x1e9307
avrdude: safemode read 1, lfuse value: bf
avrdude: safemode read 2, lfuse value: bf
avrdude: safemode read 3, lfuse value: bf
avrdude: safemode: lfuse reads as BF
avrdude: safemode read 1, hfuse value: dc
avrdude: safemode read 2, hfuse value: dc
avrdude: safemode read 3, hfuse value: dc
avrdude: safemode: hfuse reads as DC
avrdude: current erase-rewrite cycle count is -18 (if being tracked)

avrdude: safemode read 1, lfuse value: bf
avrdude: safemode read 2, lfuse value: bf
avrdude: safemode read 3, lfuse value: bf
avrdude: safemode: lfuse reads as BF
avrdude: safemode read 1, hfuse value: dc
avrdude: safemode read 2, hfuse value: dc
avrdude: safemode read 3, hfuse value: dc
avrdude: safemode: hfuse reads as DC
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

How should i fix these.
Note: i am using disable reset on serial connection, and added 10 between rst and Vin of the target arduino. Also 16 mhz as xtal. I am trying to upload optiboot bootloader.

Thanks,
Debojit

Those symptoms happen when the auto-reset occurs on the Arduino running ArduinoISP. Because of the reset you end up talking to the Arduino bootloader instead of the ArduinoISP sketch. The bootloader speaks almost the same protocol as an ISP so it can get pretty far before the upload effort hits an error.

You can disable the auto-reset by adding a capacitor of 1 to 10 microfarad between the Reset pin (+ lead of capacitor) and the Ground pin (- lead of capacitor). This absorbs the reset pulse and prevents the reset but allows the Reset button to force a reset if needed.

Hi johnwasser,

Thanks for the reply. However I am using 10uf between rst and gnd, and 110 ohm resistor between rst and 5v in to disable auto reset. When I posted my issue then only i was having the auto reset disable connections active. I am clueless of the random issues.
hexskrew in one of his post said that the target atmega should be powered with separate power source. I will give it a try.
Any other idea is warmly accepted.

Thanks,
Debojit

An LED (and ~220R resistor) on Pin 9 on the programming Arduino will provide a pulsing "heartbeat" to ensure that ArduinoISP is running -- that your Arduino is not resetting inadvertently.

110ohm... Isn't that kind of low, or is that normal now? I've always used 10K.

SirNickity:
110ohm... Isn't that kind of low, or is that normal now? I've always used 10K.

It is correct in this context:

http://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection

"Don't go below 110 ohms or above 124 ohms"

Is there a silver or gold ring at the end of your resistor? if you use 5% resistors your resistor could already be too high (120 + 5% = 126)

Guys,
Better news:
I had 2 atmega8Ls those I was thinking of bricked, but with external power setup (powering the target arduino with 9v dc adapter+7805) they are performing with no issues. The device signature issues are no more and i am able to burn program as ell as bootloader on both the chips.
Now I bought another atmega8L (thinking the earlier 2 were gone), seems to be very stubborn. With the same setup I am not able to burn the program. It is still showing device signature mismatch. I have replaced chips several times only to see this one is being the exception. Do you have any idea why this is happening, or you can suggest any other tool/programmer to try out with.
I have follwoing options left:

  1. different version of avrdude
  2. Any other missing option of avrdude that you can suggest
  3. Altogether different tool that you can suggest.
  4. Parallel port programmer.

Please help.
Thanks in advance.
Debojit

I just wanted to elaborate my connection:
pin-
7-vcc
8-gnd
1-rst and 10k connected with Vcc
9,10-16mhz xtal with 2 22 pf cap
17-mosi
18-miso
19-sck

with arduino and target atmega
10-1
11-17
12-18
13-19
120ohm between Vcc and rst, 10uf between rst and gnd.

Guys,
dont be quiet. please answer. i think today i have lost my mega328. it is again giving me invalid device signature 0x000000. it is costly. i cant afford bricking a chip every day. if u have any full proof answer please come up and help.

invalid device signature 0x000000

I think that usually means bad connection or bad system clock on the target machine. The SPI-like interface has the ISP clocking data into and out of the target processor. If the SCK signal does't get to the target, no data. If the MOSI signal doesn't get to the target, no commands so no data. If the MISO signal doesn't get back from the target, no data. If the target's system clock is not running (or is too slow to catch the data clock), no data.

No Data usually shows up as a signature of 0x000000 or 0xFFFFFF.

2 things, Do you have any bypassing on your programming board, the one that seems to be failing? and use either the reset fix resistor or the cap both are not required together.
I built the Adafruit Programming shield and I added an extra 2.2uF tantalum SMD cap across the power bus on the bottom of the board... and an extra 100 nF making the total 3 X 100 nF and 1 X 2.2uF. My board works flawlessly.. Or at least on 2313's 328's and 85's. Of the three only the 85's are programmed on the shield the others are programmed on Evil Mad Scientists" black proto boards and all work fine I rewired the ISP port on the shield to connect to D10 instead of reset and I can program any chip that has an ISP port connected. The shield only programs 84's and 85's. I haven't had the opportunity to test the 84's yet as I don't own any.

Doc

I'm still sticking with my suggestion that you add the heartbeat LED on pin 9.

The adafruit shield has it so I used it too... I used an RGB LED and it's quite impressive when it's all going on.

Doc

Thanks for the replies. First please tell, did i fry my device. If not is there any way to check with multimeter to see if the device is ok.
Few observations from my side:
When i was getting device signature error, i was removing the wires one by one: sck, miso, mosi, then rst. Even after removing all the connections it is giving me same error unless I reset the arduino. Now when i again wire up properly it give the device signature error. But strangely the same setup was working day before yesterday flawlessly. And with the same setup atmega8 are getting burnt properly.
Can parallel port programmer help here. Should i tru some other h/w programmer.
I actually tried one thing as i explain below after which it has started showing the error:
I bought a usb to ttl pl2303 board, and i coonetected the rx, tx, and gnd to 328's respective pins to program it with serial connection. It resulted in an error.
then i again try to program it with arduino. that point onwards it gives me this issue. If i do a device signature override with -F option it results in "write failed" error during writing lock/fuse bits.

  1. Should I try with some different frequency xtal
  2. Should I use -B option with avrdude.
    I would try the follwoing thing today:
  3. arduino Pin 9 for error check.
    Looking forward for your response.
    Thanks,
    Debojit