Struggling with bootloader onto TQFP atmegas

Hi all.
I'm running into issues loading the Arduino bootloader onto some atMega328P-AN (TQFP package) chips.
The errors vary between Getsync resp=0x15 and Yikes invalid device signature.
I greatly appreciate your help!

The setup is like this:
Arduino Duemilanove as ISP (with the appropriate code uploaded, and Arduino as ISP selected as programmer) on COM3, Windows 7.
I verified this setup by burning a PDIP atmega on a breadboard; worked fine.

Duemilanove pins: --Target board pin: (TQFP pin #)
10 - - - RESET (29)
11 - - - 11 MOSI (15)
12 - - - 12 MISO (16)
13 - - - 13 SCK (17)

The target board is a homebrew, but has:

  • Power and ground from Duemilanove
  • 10k pullup on RESET
  • 10uF across VCC and GND
  • 16MHz crystal with 22pF caps to ground
  • VCC to 4, 6, 18, and GND to 3, 5, 21

and I verified that the board pins are connected to the chip pins as expected, with no shorts.

I'm at a loss, I've connected and reconnected everything a hundred times.
Any insight is greatly appreciated!

The errors vary between Getsync resp=0x15 and Yikes invalid device signature.

Pick one (the first one) and run it to completion.

How do you mean?
It varies without my changing anything.
So, 'burn bootloader' .. error 1
'burn bootloader' again .. error 2
which doesn't seem entirely unreasonable, since they're both blanket errors.

PolkaDot:
How do you mean?

Start with the very first error message after power up. Ensure the error message is reproducible (reset the Duemilanove, toggle power to the target, retry burning the bootloader). Determine what problems could cause that error. Investigate each potential problem.

which doesn't seem entirely unreasonable, since they're both blanket errors.

"Blanket errors"? I suspect this is not going to go well.

If you have not already done so, I suggest you get a DIP 328 and a breadboard and figure out how to upload to that first. It's a small additional cost and would help to identify whether the problem is with the DUE or the chip.

...R

For the 328P you need a 0.1uF capacitor going from the reset line to ground along with your 10K from reset to vcc. The 32u4 only requires the 10K from reset to vcc. No capacitor.

I've never had a 0.1uF from reset to Gnd. That's only needed in really electrically noisy environments.

Polkadot,
Can you try it with Nick Gammon's Arduino as ISP?

You should see it on every Arduino using the 328P. Check out a schematic for the UNO or nano. Pretty much every Arduino except for the Leonardo. I design custom arduino derivatives all the time and had the exact same problem.

I don't see any caps from Reset to Gnd on the Arduino schematics. Nor do I use one on my boards:
http://www.crossroadsfencing.com/BobuinoRev17/

What you will find is a cap from Reset to DTR output from USB/Serial interface chip so that DTR level can create a low Reset pulse.
It does not come into play when ISP is being used to program a bootloader, and ISP takes Reset low and holds it there.

You are correct. No cap to ground on the reset line. I have no idea where I got that from. I'll check the original rev 1 design. Sorry about causing any confusion.

This app note does show one, but only for noisy environments.

atmel-AVR042-avr-hardware-design-considerations_application-note 7-2013.pdf (758 KB)

Robin2:
I suggest you get a DIP 328 and a breadboard and figure out how to upload to that first.

I have, it worked fine.

CrossRoads,
I am not familiar with Nick's program, and Gammon Forum : Electronics : Microprocessors : Atmega bootloader programmer only gives the hardware setup, so maybe I'm doing it wrong. But after uploading it to Duemilanove, the serial monitor only displays gibberish.
I'm using Arduino 1.0.5-r2, which I believe is the most recent.

Links to the code are at the top of the page:

Code

http://gammon.com.au/Arduino/Atmega_Board_Programmer.zip

Download the above file, unzip it, and place the resulting folder into your Arduino "sketches" folder.

If you try to compile under older versions of the Arduino IDE, which do not support the F macro, you will get errors. You can get a copy of that here:

http://arduiniana.org/libraries/flash/

You can also get the code from GitHub (this will also show recent changes):

Right, got that.
I meant do you select 'Burn Bootloader' like you would with the normal AVR as ISP, or does the entire thing operate through the serial monitor?

I think you just open the serial monitor and interact there with the sketch that is downloaded into the Duemilanove.

I think I figured out the problem.. my board multiplexes the SPI bus to other ICs. I thought just disabling the MUX would be enough, but it seems to be still loading the pins. When I added resistors in series between the ICSP and MUX, as per:

the bootloader made it!

Out of curiosity, does anyone know what value R is appropriate here? The appnote doesn't give values, and I used 220R because they were on hand. Will check that the SPI still works as intended tomorrow.