Slight issue programming bootloader onto DIY Micro ATmega32u4

Just made my own custom Arduino Micro to include couple extra buttons and a micro SD card reader, trying to use my Arduino Mega as ISP and burn the bootloader onto board; however I'm getting the following error message:

Arduino: 1.8.12 (Windows 10), Board: "Arduino Micro"

B:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CB:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega32u4 -cstk500v1 -PCOM3 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xcb:m -Uhfuse:w:0xd8:m -Ulfuse:w:0xff:m

avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "B:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

Using Port : COM3
Using Programmer : stk500v1
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 MaxW ReadBack


eeprom 65 20 4 0 no 1024 4 0 9000 9000 0x00 0x00
flash 65 6 128 0 yes 32768 128 256 4500 4500 0x00 0x00
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 1 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 (probably .avr8x_mega) (retrying)

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

avrdude: Device signature = 0xffffff (probably .avr8x_mega) (retrying)

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

avrdude: Device signature = 0xffffff (probably .avr8x_mega)
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.

avrdude done. Thank you.

And was wondering what is going wrong, I have all the connections wired up correctly minus the power.

This was due to me realising I had connected the VCC on the ISCP header to 3.3V instead of 5V on my schematic; however this was sorted by simply connecting VCC to 3.3V on the mega instead of 5V.

avrdude: Device signature = 0xffffff

That usually means a bad connection or the processor clock on the target processor is not running. Are you sure the ICSP header on your custom board is connected to all the right pins?

Please show us a wiring diagram and board schematics instead of a verbal description.

aarg:
Please show us a wiring diagram and board schematics instead of a verbal description.

Sure thing schematic is here:

Wiring from Mega to the ISCP header on the pcb board is as follows:

GND - GND
MOSI - Pin 51 (Mega)
VCC - 3.3V
MISO - Pin 10 (Mega)
SCK - Pin 51 (Mega)
RST - Pin 50 (Mega)

MOSI - Pin 51 (Mega)
VCC - 3.3V
MISO - Pin 10 (Mega)
SCK - Pin 51 (Mega)
RST - Pin 50 (Mega)

That's the problem. The correct pins on the MEGA are:

MOSI -> Pin 51 (MOSI on the Mega)
MISO -> Pin 50 (MISO on the Mega)
SCK -> Pin 52 (SCK on the Mega)
RST -> Pin 10 (although SS defauts to 53 on the Mega)

Ah perfect, was just a case of switching the RST & MISO pin (the SCK pin 51 was a mistype as can't have sck & mosi on 1 pin).

Loaded bootloader and blink test works perfectly fine. Now I'm all set.