I got this new message:
avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: Expected signature for ATmega8U2 is 1E 93 89
Double check chip, or use -F to override this check.
I got this new message:
avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: Expected signature for ATmega8U2 is 1E 93 89
Double check chip, or use -F to override this check.
disconnect the wrong Mega from USB. let it be powered from the 'programmer' Mega. do you have the "Arduino as ISP" sketch in the Mega? do you have the 'anti-reset' capacitor on reset pin of programmer Mega?
The wrong board is fed through the good board. Only the good board is fed via USB. Yes, I've the good Mega as ISP with the sketch ArduinoISP uploaded. How I do the "anti-reset" capacitor on reset pin at the good board? I connected the PIN 10 from good board to the 5 pin of ICSP of the wrong board. Is it ok? Please, clarify which group of pins may I use from both boards. 1) ICSP (good board) to ICSP (wrong board) 2) ICSP (good board) to AREF (wrong board) - those near the USB-
Thanks @Juraj
REM14:
The wrong board is fed through the good board. Only the good board is fed via USB. Yes, I've the good Mega as ISP with the sketch ArduinoISP uploaded. How I do the "anti-reset" capacitor on reset pin at the good board? I connected the PIN 10 from good board to the 5 pin of ICSP of the wrong board. Is it ok? Please, clarify which group of pins may I use from both boards. 1) ICSP (good board) to ICSP (wrong board) 2) ICSP (good board) to AREF (wrong board) - those near the USB-Thanks @Juraj
the AREF is a pin on the female header on the side of Uno, next to Gnd pin
the ICSP of the 8u2 is on some boards labeled ICSP2
you should connect ICSP of programmer board to ICSP2 of 8u2 of the programmed board
about the anti-reset capaciitor. search in this https://www.arduino.cc/en/Tutorial/ArduinoISP
"Anti-reset" cap is between RESET and GND pin, value about 10uF.
I think Juraj hints you to use ICSP connector next to 8U2 chip if you want to program 8U2 chip. The signals from the source board leads out always from main MCU's ICSP or from headers.
Juraj overcame me...
You're still connected to the wrong ICSP header on the bad board. CONNECT TO THE ICSP HEADER NEXT TO THE ATMEGA8U2 ON THE BAD BOARD!
@pert, initially, I've done it like your photo, however, didn't work either. This is my message after executing the command:
C:\>C:"\Program Files (x86)"\Arduino\hardware\tools\avr\bin\avrdude -C"C:\Program Files (x86)"\Arduino\hardware\tools\avr\etc\avrdude.conf -v -p atmega8u2 -c stk500v1 -PCOM4 -b19200 -U flash:w:MEGA-dfu_and_usbserial_combined.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m
avrdude: Version 6.3-20171130
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf"
Using Port : COM4
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03
AVR Part : ATmega8U2
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 8192 128 64 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.03s
avrdude: Device signature = 0xffffff (probably .avr8x_mega) (retrying)
Reading | ################################################## | 100% 0.03s
avrdude: Device signature = 0xffffff (probably .avr8x_mega) (retrying)
Reading | ################################################## | 100% 0.03s
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.
I've connected a cap 10uF between reset and GND of the good board and now I receive this message:
avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: Expected signature for ATmega8U2 is 1E 93 89
Double check chip, or use -F to override this check.
Using this command:
C:"\Program Files (x86)"\Arduino\hardware\tools\avr\bin\avrdude -C"C:\Program Files (x86)"\Arduino\hardware\tools\avr\etc\avrdude.conf -v -p atmega8u2 -c stk500v1 -PCOM4 -b19200 -U flash:w:MEGA-dfu_and_usbserial_combined.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m
In case it wasn't clear. The good board is an original arduino Mega2560 with chip MEGA16U2 and the wrong board is a SainSmart Mega 2560 with chip MEGA8U2.
Are the HEX file and/or lfuse/hfuse/efuse/lock values right?
I think you need to take a minute to understand what is going on here.
There are two microcontrollers on your Mega board.
The one you are usually working with is the ATmega2560. That is the largest chip on the board. The ICSP header next to the ATmega2560 is connected to the ATmega2560 and can only be used to program the ATmega2560.
The other microcontroller is the ATmega8U2. The purpose of this chip is to act as a bridge to allow the computer and the ATmega2560 to communicate over a USB cable. The reason this is necessary is because the ATmega2560 doesn't have any USB capabilities. It does have serial communication capabilities but that's different than USB so you can't just connect the serial lines directly to the USB on the computer. The ATmega8U2 does have USB capabilities. It communicates with your computer over USB and with the ATmega2560 over serial. The ICSP header next to the ATmega8U2 is connected to the ATmega8U2 and can only be used to program the ATmega8U2.
So trying to update the firmware on the ATmega8U2 through the ICSP header next to the ATmega2560 is just silly. It doesn't matter how much you want that to work, it never will work. So you're just wasting everyone's time by persisting with that. If you want to update the ATmega8U2's firmware, you need to connect to the ICSP header next to the ATmega8U2. If that's not working then you need to either find out why or else accept that you fried the ATmega8U2 and you need to buy a new Mega.
@pert, I don't want to waste anyone's time. I assure, I would like to fix my board with your kind help.
I understand there are two microcontrollers. I've tried different combinations. Could you confirm me that I should connect the ICSP pins of the ATMEGA2560 (good board) to the ISCP pins of the MEGA8U2 (bad board)? Like the one shown in the picture of your reply.
REM14:
Could you confirm me that I should connect the ICSP pins of the ATMEGA2560 (good board) to the ISCP pins of the MEGA8U2 (bad board)?
YES, exactly. This is we are talking about all the time.
This:
avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: Expected signature for ATmega8U2 is 1E 93 89.
probably means that you connected it to wrong ICSP on target board.
With the correct connection (without cap 10uF), I receive the following:
C:\>C:"\Program Files (x86)"\Arduino\hardware\tools\avr\bin\avrdude -C"C:\Program Files (x86)"\Arduino\hardware\tools\avr\etc\avrdude.conf -v -p atmega8u2 -c stk500v1 -PCOM4 -b19200 -U flash:w:MEGA-dfu_and_usbserial_combined.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m
avrdude: Version 6.3-20171130
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf"
Using Port : COM4
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03
AVR Part : ATmega8U2
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 8192 128 64 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.03s
avrdude: Device signature = 0xffffff (probably .avr8x_mega) (retrying)
Reading | ################################################## | 100% 0.04s
avrdude: Device signature = 0xffffff (probably .avr8x_mega) (retrying)
Reading | ################################################## | 100% 0.04s
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.
Any suggestion?
make sure you didn't wire the ICSP2 header up-side down.
@Juraj this is my connection. The bottom board is the good one. Is this correct?
The wiring looks correct to me.
Thanks @pert
In software, I do:
C:"\Program Files (x86)"\Arduino\hardware\tools\avr\bin\avrdude -C"C:\Program Files (x86)"\Arduino\hardware\tools\avr\etc\avrdude.conf -v -p atmega2560 -c stk500v1 -PCOM4 -b19200 -U flash:w:MEGA-dfu_and_usbserial_combined.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m
I remind that the wrong board is SainSmart Mega 2560 with chip MEGA8U2 and the good one Arduino (original) Mega 2560 with chip MEGA16U2.
Is the command correct? I don't know what else to do. Thanks
then the only conclusion is that the 8u2 is dead
Is it possible to check with a tester if the USB is dead? How?