Still having issues using ArduinoISP sketch to install bootloader

I've been working on a radio project using an ATmega128 for a little under a year now-for the last six months (off and on, you know how hobby projects go) I have been working on getting a custom board done and working using this microcontroller and the Arduino Megacore. I bought a pair of ATmega128's at a hamfest and have bought a dozen ATmega2561's from Sparkfun when they went on sale at a big discount, they seem to be pin-compatable so I plan to assemble boards from both eventually.

Now, I've had 10 boards made, and have assembled one. (SMD is great, the hotplate method works!) It's time to program the bootloader and I get the following error every time:

Arduino: 1.6.9 (Windows 10), Board: "ATmega128, Disabled, Disabled (default), 16 MHz external"

avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch

System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\MegaCore-master\avr/avrdude.conf"

Using Port : COM3
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega128
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
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 12 64 0 no 4096 8 0 9000 9000 0xff 0xff
flash 33 6 128 0 yes 131072 256 512 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 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 : 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.02s

avrdude: Device signature = 0xffffff (retrying)

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0xffffff (retrying)

Error while burning bootloader.
Reading | ################################################## | 100% 0.02s

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.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

In addition to the above, as soon as I connect up the +5v supply to the new target board, the "TX" LED lights up very, very dimly on the CP2102 USB converter circuit that's on the target board. The Green "RX" LED doesn't light at all, but the Red "TX" led just barely glows. I am assuming I may need to up-size the 470R series resistor to knock that out, but I also acknowledge the possibility that the CP2102 might be shorted/improperly soldered...I hope not, as it's a QFN24 and appears very difficult to desolder, even though it seemed very easy to solder when I put it together.

Any ideas as to what may be going wrong? Did I end up with a dead/dud/fake ATmega128?

To program the ATMega2560 using an Arduino as an ISP you'll need to do a bit of fiddling.
You'll also typically want to to use the 'Arduino as ISP', rather than 'ArduinoISP'.
Can you post a schematic of your custom board?

This is a ATmega128/1281/2561, the 64 pin TQFP package. These specifically use different programming pins, and that catches people up sometimes.

I'll get the schematic posted up shortly.

ATmega128schematic.pdf (94 KB)

Also, "Arduino as ISP" is incredibly hard to find these days-it's not distributed anymore. Only ArduinoISP comes with the IDE, at least with 1.6.9. I don't have any older versions anymore, I always kept them up to date, but stopped at 1.6.9 until I finished this project-as some of the code is already written "chunks" that are semi-portable and were a lot of work, and were written on 1.6.9.

Anyone have any suggestions on where to find the "arduino as isp" sketch these days?

Xnke:
Also, "Arduino as ISP" is incredibly hard to find these days-it's not distributed anymore. Only ArduinoISP comes with the IDE, at least with 1.6.9. I don't have any older versions anymore, I always kept them up to date, but stopped at 1.6.9 until I finished this project-as some of the code is already written "chunks" that are semi-portable and were a lot of work, and were written on 1.6.9.

Anyone have any suggestions on where to find the "arduino as isp" sketch these days?

Sorry, you're right. I'd gotten myself mixed up between Arduino as ISP and ArduinoISP.

You can also use Nick Gammon's Programmer code, which runs on my Standalone Programmer hardware:

http://www.crossroadsfencing.com/BobuinoRev17/

Here's the chips it supports, and others could be added:

// see Atmega datasheets
const signatureType signatures [] PROGMEM = 
  {
//     signature        description   flash size   bootloader  flash  fuse
//                                                     size    page    to
//                                                             size   change

  // Attiny84 family
  { { 0x1E, 0x91, 0x0B }, "ATtiny24",   2 * kb,           0,   32,   NO_FUSE },
  { { 0x1E, 0x92, 0x07 }, "ATtiny44",   4 * kb,           0,   64,   NO_FUSE },
  { { 0x1E, 0x93, 0x0C }, "ATtiny84",   8 * kb,           0,   64,   NO_FUSE },

  // Attiny85 family
  { { 0x1E, 0x91, 0x08 }, "ATtiny25",   2 * kb,           0,   32,   NO_FUSE },
  { { 0x1E, 0x92, 0x06 }, "ATtiny45",   4 * kb,           0,   64,   NO_FUSE },
  { { 0x1E, 0x93, 0x0B }, "ATtiny85",   8 * kb,           0,   64,   NO_FUSE },

  // Atmega328 family
  { { 0x1E, 0x92, 0x0A }, "ATmega48PA",   4 * kb,         0,    64,  NO_FUSE },
  { { 0x1E, 0x93, 0x0F }, "ATmega88PA",   8 * kb,       256,   128,  extFuse },
  { { 0x1E, 0x94, 0x0B }, "ATmega168PA", 16 * kb,       256,   128,  extFuse },
  { { 0x1E, 0x95, 0x0F }, "ATmega328P",  32 * kb,       512,   128,  highFuse },

  // Atmega644 family
  { { 0x1E, 0x94, 0x0A }, "ATmega164P",   16 * kb,      256,   128,  highFuse },
  { { 0x1E, 0x95, 0x08 }, "ATmega324P",   32 * kb,      512,   128,  highFuse },
  { { 0x1E, 0x96, 0x0A }, "ATmega644P",   64 * kb,   1 * kb,   256,  highFuse },

  // Atmega2560 family
  { { 0x1E, 0x96, 0x08 }, "ATmega640",    64 * kb,   1 * kb,   256,  highFuse },
  { { 0x1E, 0x97, 0x03 }, "ATmega1280",  128 * kb,   1 * kb,   256,  highFuse },
  { { 0x1E, 0x97, 0x04 }, "ATmega1281",  128 * kb,   1 * kb,   256,  highFuse },
  { { 0x1E, 0x98, 0x01 }, "ATmega2560",  256 * kb,   1 * kb,   256,  highFuse },
      
  { { 0x1E, 0x98, 0x02 }, "ATmega2561",  256 * kb,   1 * kb,   256,  highFuse },
  
  // AT90USB family
  { { 0x1E, 0x93, 0x82 }, "At90USB82",    8 * kb,       512,   128,  highFuse },
  { { 0x1E, 0x94, 0x82 }, "At90USB162",  16 * kb,       512,   128,  highFuse },

  // Atmega32U2 family
  { { 0x1E, 0x93, 0x89 }, "ATmega8U2",    8 * kb,       512,   128,  highFuse  },
  { { 0x1E, 0x94, 0x89 }, "ATmega16U2",  16 * kb,       512,   128,  highFuse  },
  { { 0x1E, 0x95, 0x8A }, "ATmega32U2",  32 * kb,       512,   128,  highFuse  },

  // Atmega32U4 family -  (datasheet is wrong about flash page size being 128 words)
  { { 0x1E, 0x94, 0x88 }, "ATmega16U4",  16 * kb,       512,   128,  highFuse },
  { { 0x1E, 0x95, 0x87 }, "ATmega32U4",  32 * kb,       512,   128,  highFuse },

  // ATmega1284P family
  { { 0x1E, 0x97, 0x05 }, "ATmega1284P", 128 * kb,   1 * kb,   256,  highFuse  },
  
  // ATtiny4313 family
  { { 0x1E, 0x91, 0x0A }, "ATtiny2313A",   2 * kb,        0,    32,  NO_FUSE  },
  { { 0x1E, 0x92, 0x0D }, "ATtiny4313",    4 * kb,        0,    64,  NO_FUSE  },

  // ATtiny13 family
  { { 0x1E, 0x90, 0x07 }, "ATtiny13A",     1 * kb,        0,    32,  NO_FUSE },
 
   // Atmega8A family
  { { 0x1E, 0x93, 0x07 }, "ATmega8A",      8 * kb,      256,    64,  highFuse, true },

  // ATmega64rfr2 family
  { { 0x1E, 0xA6, 0x02 }, "ATmega64rfr2",  256 * kb, 1 * kb,   256, highFuse },
  { { 0x1E, 0xA7, 0x02 }, "ATmega128rfr2", 256 * kb, 1 * kb,   256, highFuse },
  { { 0x1E, 0xA8, 0x02 }, "ATmega256rfr2", 256 * kb, 1 * kb,   256, highFuse },

  };  // end of signatures

"I'll get the schematic posted up shortly."

Check capacitor C3 and C4. Should be 22pF and not .1uF on the crystal.

Yes, the schematic I posted is very, very wrong on some of the values. I don't know what I was thinking when I drew it up...

Anyway, C3, C4 is 22pf, all resistors are 10K except the pull-ups on LED1 and LED2, which are 470R. All other caps are 0.1uf.

Anyway, removing the pull-ups on LED1 and LED2 changed the reported signature to 0x000000, which tends to point toward the clock not running OR the USB chip screwing up the lines.

One more try. :slight_smile:

Check the minimal setup on:

The note talks about the value of R1 on PD1 as being 0 ohms or 1000 ohms in order for the programmer to recognize the MCU.

You show R4 and R5 on the PD1 and PD0 leads and you stated they were 10,000 ohms.

Also, "Arduino as ISP" is incredibly hard to find these days-it's not distributed anymore. Only ArduinoISP comes with the IDE, at least with 1.6.9.

Huh? The "Arduino as ISP" sketch is (always has been?) named "ArduinoISP" (in the "examples" menu), but you have to set the "programmer" (tools menu) as "Arduino as ISP" to use it. There is (was?) a separate "AduinoISP" programming board that would use the "ArduinoISP" programmer type.

Indeed, they were 10K. I first removed and shorted them for 0 ohms, and that issued no change in behavior, so I installed 1K resistors. This also did not change the behavior of the board-I get 0x000000 as the reply in all cases now.

Ok, so I stripped off the Ebay ATmega128, and replaced it with a sparkfun-sourced ATmega2561. Immediately, first try, the bootloader flashes onto the chip. (and I hand-soldered the sucker too, so this was not guaranteed!)

Now, I'm working on getting communications going via the USB controller. I'm using a CP2102 controller, and the bootloader was configured for Megacore ATmega2561, 4.3v brown-out detection, LTO disabled, 16Mhz external crystal.

The following is what I get when trying to upload a sketch via USB:

Sketch uses 12,080 bytes (4%) of program storage space. Maximum is 261,120 bytes.
Global variables use 1,364 bytes (16%) of dynamic memory, leaving 6,828 bytes for local variables. Maximum is 8,192 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x54
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x54

the sketch is actually in the Megacore examples folder, for the SD cardinfo sketch.

Anyone got anything I can try for this problem?

Seems that all my problems were caused by not connecting VUSB and system +5V lines together. I remember I mention all doing so as to prevent trying to power the whole radio from the USB bus, but I totally forgot to put a jumper or pad or something on the board for development purposes. If both the +5V pad and VUSB are powered with +5V, the board works absolutely normally.