ArduinoMega Pin8 goes high error as soon as I start avrdude

I'm using the ArduinoMega 2560 as programmer to program a Atmega16U2 chip.

Uploaded the ArduinoISP into the ArduinoMega and added 10uF capacitor as mentioned here.
https://www.arduino.cc/en/tutorial/arduinoISP

Connected the SPI interface (MOSI, MISO, pin 10 to reset, SCK and power)
as soon as I run "avrdude -p m16u2 -c avrisp -P COM7 " the duty cycle of the heart beat stops (pin 9) and I get an error in pin 8 of the Arduino Mega, a few seconds later I get:

"C:>avrdude -p m16u2 -c avrisp -v -P COM7

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 : COM7
Using Programmer : avrisp
avrdude: stk500_getsync(): not in sync: resp=0x00

avrdude done. Thank you."

for the m16u2 I used the configuration found here:
http://www.nmj.sumomo.ne.jp/suz-avr/USB162/avrdude-5.8-confu2.patch as recommended here: Reprograming the Mega16U2 - Installation & Troubleshooting - Arduino Forum

Is it ok to use "-c avrisp" for the Arduino Mega?
I believe the Atmega16U2-MU is working fine. I was able to program it using the Flip program via USB (Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex); however, I need to change one of the fuses because the baud rate is not correct (1/8 of the desired speed) . So my final goal is to change the fuses and that is why I'm using the Arduino Mega to program the Atmega16U2-MU.
Thanks!

Connected the SPI interface (MOSI, MISO, pin 10 to reset, SCK and power)

Which pins are you using for MOSI, MISO, and SCK?

Pins 50 MISO, 51 MOSI and 52 SCK in the Mega. Those wires go to the Atmega16U2 SPI pins located near the USB plug.

avrdude -p m16u2 -c avrisp -P COM7 -b19200

Try adding -b19200.
I usually use stk500v1, but -c avrisp seems to work for reading the fuses.

avrdude: Device signature = 0x1e9489 (probably m16u2)
avrdude: safemode: hfuse reads as D9
avrdude: safemode: efuse reads as F4

avrdude: safemode: hfuse reads as D9
avrdude: safemode: efuse reads as F4
avrdude: safemode: Fuses OK (E:F4, H:D9, L:FF)

I tried changing the baud rate before, but it didn’t help. I’ll try again just in case. Also, how do I go about using stk5000v1? Thanks!

avrdude -p m16u2 -c stk500v1 -P COM7 -b 19200 -v

Stk500v1 used to be used with "Arduino as ISP". The new version uses -c arduino, which is why you need a 10 uF capacitor between Reset and Gnd on the Arduino used as Isp.

Success! I tried -b 19200 again. Why do I have to use that option?
Thanks.
Patricio

C:>avrdude -p m16u2 -c avrisp -v -P COM7 -b 19200

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 : COM7
Using Programmer : avrisp
Overriding Baud Rate : 19200
AVR Part : ATMEGA16U2
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC6
RESET disposition : possible i/o
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 512 4 128 9000 9000 0x00 0x00
flash 65 6 128 0 yes 16384 128 128 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 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: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x1e9489
avrdude: safemode: lfuse reads as 5E
avrdude: safemode: hfuse reads as D9
avrdude: safemode: efuse reads as F4

avrdude: safemode: lfuse reads as 5E
avrdude: safemode: hfuse reads as D9
avrdude: safemode: efuse reads as F4
avrdude: safemode: Fuses OK

avrdude done. Thank you.

Why do I have to use that option?

If you look in the ArduinoISP sketch around line 140, you will find where the baud rate is configured.

// Configure the baud rate:

#define BAUDRATE 19200
// #define BAUDRATE 115200
// #define BAUDRATE 1000000
Is there a reason you are using old information? There should be a newer
Avrdude available.