Please help Trying to program custom ATMEGA32U4 Board with Uno Error

All,
I am new to the forum and to electronics. I come from a mechanical background so please excuse my ignorance. I have a custom board based very closely on the Arduino Micro. I had been trying to program this board using the micro as a programmer and have continually ran into errors. I learned about the bugs that leonardos and micros have when being used as programmers so today I purchased an Uno. I used the Uno as a programmer to upload a simple program to one of my micros to validate my method. This was successful.
However, when I attempt to use the Uno to program my custom board I am continually getting the following error:

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 : \.\COM12
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
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 : STK500
Description : Atmel STK500 Version 1.x firmware
avrdude: Send: A [41] . [80] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [02]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [81] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [98] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
avrdude: Send: A [41] . [84] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [85] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [86] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [87] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [89] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us

avrdude: Send: A [41] . [81] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: B [42] . [00] . [00] . [00] . [01] . [01] . [01] . [01] . [03] . [00] . [00] . [00] . [00] . [00] . [80] . [04] . [00] . [00] . [00] . [80] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: E [45] . [05] . [08] . [d7] . [a0] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: P [50] [20]
avrdude: Recv:
avrdude: stk500_program_enable(): protocol error, expect=0x14, resp=0x50
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude: Send: Q [51] [20]
avrdude: Recv:
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

avrdude done. Thank you.

I have attached images of my board and the eagle file that the board was manufactured from.

I have checked all connections several times. I have searched for several hours on ways to resolve this and have had no luck. Any feedback would be greatly appreciated.
Thanks!
Jon

CxC Board - Embedded - Frozen.sch (150 KB)

CxC Board - Embedded - Frozen.brd (108 KB)

There was something with PE2, but I forgot what it was.

The crystal with 22pF should be close the ATmega, and the return ground of the 22pF should be very short.
On your board it is too far away, but I think it might still work.

When C6 and C7 are the decoupling capacitors for the ATmega, they should be very close to the ATmega. The traces from those capacitors to the ATmega are too long. This means that the ATmega doesn't have (a good) decoupling for the VCC. Can you add one or two 100nF next to the ATmega ?

Can you run avrdude from the command line ? There is an option -vvv for more info.
Try avrdude without doing something: avrdude -c avrisp -p m32u4 -vvv

Peter,
Thanks a lot for the response. I had not previously used avrdude from command line. I tried this method and after a little fiddling got the following results (again, please excuse ignorance, I'm not sure what I am doing) :

C:\Users\Owner>avrdude -c arduino -p m32u4 -P com12 -vvv

avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch

System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"

Using Port : com12
Using Programmer : arduino
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 Max
W ReadBack



eeprom 65 10 8 0 no 1024 8 0 9000 90
00 0x00 0x00
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack



flash 65 6 128 0 yes 32768 128 256 4500 45
00 0x00 0x00
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack



lfuse 0 0 0 0 no 1 0 0 9000 90
00 0x00 0x00
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack



hfuse 0 0 0 0 no 1 0 0 9000 90
00 0x00 0x00
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack



efuse 0 0 0 0 no 1 0 0 9000 90
00 0x00 0x00
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack



lock 0 0 0 0 no 1 0 0 9000 90
00 0x00 0x00
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W 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 Max
W ReadBack



signature 0 0 0 0 no 3 0 0 0
0 0x00 0x00

Programmer Type : Arduino
Description : Arduino
Hardware Version: 3
Firmware Version: 4.4
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 ATmega32U4 is 1E 95 87
Double check chip, or use -F to override this check.

avrdude done. Thank you.

I will continue to do some research. Should I add the decoupling capacitors, or try something else first?
Thanks again,
Jon

Add those capacitors before doing anything else.

The -vvv shows something strange.
I think it tells that the ArduinoISP is okay, but then it says:
avrdude: Device signature = 0x1e950f
avrdude: Expected signature for ATmega32U4 is 1E 95 87

The target should be a ATmega32u4 (the chip in the Leonardo and your board), but instead it finds a ATmega328p !
Did you really use a ATmega32u4 as target ? Can you verify with a magnifier ?
Can you check the wiring once more ? Perhaps there is a shortcurt on the circuit board. Are you sure nothing else is connected to those MISO MOSI SCK wires ? Did you investigate the use of the PE2 pin ?

mr-kigglius:
C:\Users\Owner>avrdude -c arduino -p m32u4 -P com12 -vvv

You should use the programmer type as 'avrisp' instead of 'arduino'. This should avoid the auto-reset issue. Also you should be specify the baud rate for 19200.

C:\Users\Owner>avrdude -c avrisp -p m32u4 -P com12 -b19200 -vvv

Peter and Hiduino,
Thanks again!

I have added the decoupling capacitors (please see pictures) is this location better ?( top right corner of the chip soldered to extremely large vias)

I have also looked at the PE2 function it seems that if PE2 is grounded during a reset it loads the bootloader?
from the datasheet
•HWB
– Port E, Bit 2
HWB allows to execute the bootloader section after reset when tied to ground during external
reset pulse. The HWB mode of this pin is active only when the HWBE fuse is enable. During nor-
mal operation (excluded Reset), this pin acts as a general purpose I/O.

Should my pe2 be grounded or open?

Also, i didn't plan to use the usb functionality of this device so i left pins D+, D- , and VBUS open (UGND is grounded). Could this be causing the problem?

Here is what I am getting from avrdude currently:

Full datasheet is here (with this info on page 80) http://academy.cba.mit.edu/classes/embedded_programming/doc7766.pdf

C:\Users\Owner>avrdude -c avrisp -p m32u4 -b 19200 -P com12 -vvv
avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23

  • Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/*
  • Copyright (c) 2007-2009 Joerg Wunsch*
  • System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"*
  • Using Port : com12*
  • Using Programmer : avrisp*
  • Overriding Baud Rate : 19200*
  • 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 Max*
    W ReadBack
  • ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---*
    -- ---------
  • eeprom 65 10 8 0 no 1024 8 0 9000 90*
    00 0x00 0x00
  • Block Poll Page*
  • Polled*
  • Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max*
    W ReadBack
  • ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---*
    -- ---------
  • flash 65 6 128 0 yes 32768 128 256 4500 45*
    00 0x00 0x00
  • Block Poll Page*
  • Polled*
  • Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max*
    W ReadBack
  • ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---*
    -- ---------
  • lfuse 0 0 0 0 no 1 0 0 9000 90*
    00 0x00 0x00
  • Block Poll Page*
  • Polled*
  • Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max*
    W ReadBack
  • ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---*
    -- ---------
  • hfuse 0 0 0 0 no 1 0 0 9000 90*
    00 0x00 0x00
  • Block Poll Page*
  • Polled*
  • Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max*
    W ReadBack
  • ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---*
    -- ---------
  • efuse 0 0 0 0 no 1 0 0 9000 90*
    00 0x00 0x00
  • Block Poll Page*
  • Polled*
  • Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max*
    W ReadBack
  • ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---*
    -- ---------
  • lock 0 0 0 0 no 1 0 0 9000 90*
    00 0x00 0x00
  • Block Poll Page*
  • Polled*
  • Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max*
    W 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 Max*
    W ReadBack
  • ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---*
    -- ---------
  • signature 0 0 0 0 no 3 0 0 0*
    0 0x00 0x00
  • Programmer Type : STK500*
  • Description : Atmel AVR ISP*
  • 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: stk500_program_enable(): protocol error, expect=0x14, resp=0x50
    avrdude: initialization failed, rc=-1
  • Double check connections and try again, or use -F to override*
  • this check.*
    avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
    avrdude done. Thank you.

I am going to check the board against the drawing to check for shorts and opens, beyond that I am at a loss. Any feedback is greatly appreciated.

Finally some success. Turns out there was a short across my reset button so the reset pin was staying grounded. I cut out the switch and replaced it with a push button I had lying around. Now i can upload using the IDE.
Thanks for the help!