ATMEGA 32U4 Bootloader burning problem! SOLVED but do read my story!

I am sure this came up before, but google didn't help me much in this case :frowning:

I get the following log when trying to burn the Leonardo bootloader on a standalone sytem.

C:\Program Files (x86)\Arduino\hardware/tools/avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega32u4 -cstk500v2 -Pusb -e -Ulock:w:0x3F:m -Uefuse:w:0xcb:m -Uhfuse:w:0xd8:m -Ulfuse:w:0xff:m

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 "C:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf"

Using Port : usb
Using Programmer : stk500v2
avrdude: usbdev_open(): Found AVRISP mkII, serno: 000200012345
avrdude: usbdev_open(): using read endpoint 0x83
avrdude: Sent: . [01]
avrdude: Recv: . [01] . [00] . [0a] A [41] V [56] R [52] I [49] S [53] P [50] _ [5f] M [4d] K [4b] 2 [32]
avrdude: stk500v2_getsync(): found AVRISP mkII programmer
AVR Part : ATmega32U4
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 65 10 8 0 no 1024 8 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


flash 65 6 128 0 yes 32768 128 256 4500 4500 0x00 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 9000 9000 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 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


efuse 0 0 0 0 no 1 0 0 9000 9000 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 9000 9000 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 1 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 : STK500V2
Description : Atmel STK500 Version 2.x firmware
Programmer Model: AVRISP mkII
avrdude: Sent: . [03] . [90]
avrdude: Recv: . [03] . [00] . [00]
avrdude: Sent: . [03] . [91]
avrdude: Recv: . [03] . [00] . [01]
avrdude: Sent: . [03] . [92]
avrdude: Recv: . [03] . [00] . [11]
Hardware Version: 0
Firmware Version Master : 1.17
avrdude: Sent: . [03] . [94]
avrdude: Recv: . [03] . [00] ! [21]
Vtarget : 3.3 V
avrdude: Sent: . [03] . [98]
avrdude: Recv: . [03] . [00] . [06]
SCK period : 8.00 us

avrdude: Sent: . [10] . [c8] d [64] . [19] [20] . [00] S [53] . [03] . [ac] S [53] . [00] . [00]
avrdude: Recv: . [10] . [c0]
avrdude: stk500v2_command(): command failed
avrdude: Sent: . [03] . [a1]
avrdude: Recv: . [03] . [00] . [00]
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Unknown status 0x00
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude: Sent: . [11] . [01] . [01]
avrdude: Recv: . [11] . [00]

avrdude done. Thank you.

Trying the same on a working Leonardo and comparing logs they seem to differ on

avrdude: Sent: . [10] . [c8] d [64] . [19] [20] . [00] S [53] . [03] . [ac] S [53] . [00] . [00]
avrdude: Recv: . [10] . [c0]

Vs

avrdude: Sent: . [10] . [c8] d [64] . [19] [20] . [00] S [53] . [03] . [ac] S [53] . [00] . [00]
avrdude: Recv: . [10] . [00]

Any ideas?

Update: since a message from Avrdude rc=-1 incicates that there is no comms with the target cpu, i did the following checks:

Target cpu is powered and the oscillator working
connections from icsp header are ok
voltages are ok on all vcc and avcc pins

Next i desolderred the chip, soldered it on another working leonardo pcb and was able to burn bootloader first time!

Then soldered a new 32u4 on the target pcb. Tried to burn bootloader and failed again!

Really lost now, no idea what else to try!

Any help appriciated!!

Update:

After one week of testing virtually everything, soldering and desoldering the 32u4 chip three times, checking every single pin for continuity, I managed to locate the problem. I even soldered a pre-programmed chip to eliminate the possibility of other problems!

The 0805 100nF decoupling caps bought from ebay as part of a set, were in fact 100pF!

Lesson : Everytime you solder an smd cap (they have no markings on their body) , measure it first!

I thought I d document this for the benefit of other users of the forum.

Usually you can tell 100pf apart from 100nf by the color. If you're soldering on decoupling caps and they're grey, that should make you concerned.

Measuring every cap - I'd go insane. I soldered (well, human pick and place'ed) 141 SMD caps tonight...