Have 3 Arduinos One UNO Rev 3 (works perfectly) and two MEGA 2560 (w/ different problems, see below).
Will call it Ren and Stimpy, because after all these process we are friends and they dont deserve to be called A and B. So,
UNO have chips MEGA16U2 and ATMEGA 328P.
Ren and Stimpy have chips MEGA16U2 and ATMEGA2560. Im not sure what happened to it. A friend brought them to me without knowing details (yes, I would like to know its past too).
REN
Ren was recognized by my PC (leds yellow and green ok). COM is shown in PC when I connect the board. The controller its ok. But couldnt upload any code. I saw that leds TX and RX was not working. Not sure if it was a problem caused by ATMEGA16U2 or if the problem its the ATMEGA2560.
Tried to access to DFU mode jumping Reset and GND on ICSP near the USB port. Couldnt do it. So the solution I know via DFU ---> FLIP w/ reinstalling hex file of MEGA16U2 was not able
Tried to bootupload Ren using the UNO as programmer, following this steps:
Connected UNO to PC (port and board also selected).
Opened ArduinoISP from Examples and uncommented the line for using old Uno style wiring// (using pin 11, 12 and 13 instead of the SPI header). I think this step was not neccesary.Uploaded ArduinoISP from Examples (no other boards or wirings connected to UNO)
Disconnectesd UNO and proceeded w/ wiring (Pin 13 on UNO ---> 52 on Ren, Pin 12 on UNO ---> 50 on Ren // Pin 11 on UNO ---> 51 on Ren // Pin 10 on UNO ---> Reset on Ren (the one located on Power Side) // +5V on UNO ---> +5V on Ren (the one located on Power Side) // GND on UNO ---> GND on Ren (the one located on Power Side).
Connected UNO via USB to PC.... Port: the same it was. Board is changed for the target (Ren)
Burn Bootloader.
Process completed ok, no warnings in red. But.....
Connected Ren to PC. COM is recognized well, the same as before. But still cant upload codes. When try to upload "Blink" sketch the message is:
avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer
Rx and TX leds are not blinking. There is only one difference: led on 13 blinks (lapse of 0.5 secs) all the time. If I press Reset button, this yellow led keeps on, but restart to blink when I release it. What does it mean? Do you think that Ren is leading w/ a MEGA16U2 problem? If so, Could I upgrade it in a different way than the DFU ---> FLIP process? If so, dont know how to do it, specialy if I have to deal with avrdude commands...
STIMPY
With Stimpy, the situation it was a bit worse. Stimpy was not recognized by PC, then port couldnt be selected for uploading codes via USB. I've followed the same procedure like with Ren....
After that, PC still doesnt recognize the board and again port is not able on IDE. In the same way that with Ren, now led on 13 blinks (lapse of 0.5 secs).
What could be wrong w/ them?
Many thanks in advance. From Ren, from Stimpy and of course, from me!
Cheers!
In Use Arduino Mega 2560 as ISP to bootload Arduino Mega 2560 - Microcontrollers - Arduino Forum, user REM14 was stacked on a similar problem. No access via USB and requiring upgrade the ATMEGA16U2 firmware. The solution other users gave him was using other Arduino as programmer (Arduino MEGA of a good board in that case) and its bad board, w/ wiring connected in the following way: connecting the ICSP pins of the ATMEGA2560 (good board) to the ISCP2 pins of its second chip near the USB port. Wires according this picture:
Im not very comfortable with typing commands in cmd over avrdude, so I've decided to go for the Nick Gammon programmer. According to https://www.gammon.com.au/forum/?id=11635&reply=2#reply2, the bootloader for ATMEGA16U2 is supported. Then I guessed that I could installing that firmware w/ the wiring configuration I showed above (in my case the programmer is the UNO but I also use the ICSP for programming).
I've downloaded from Github the ATmega_Board_Programmer
Connected UNO to PC (port and board also selected). No wiring yet, just USB port.
Opened Atmega_Board_Programmer sketch and uploaded.
Disconnectesd UNO and proceeded w/ wiring as showed.
Connected UNO via USB to PC.... Port: the same it was. Board is changed for the target (Ren).
Selected "Arduino as ISP" as programmer.
Opened Serial Monitor and changed bauds to 115200. Now I see the code running (before doing that I had just symbols). The output is
16:24:33.561 ->
16:24:33.561 -> Atmega chip programmer.
16:24:33.561 -> Written by Nick Gammon.
16:24:33.561 -> Version 1.38
16:24:33.561 -> Compiled on Aug 20 2020 at 13:24:50 with Arduino IDE 10813.
16:24:33.561 -> Attempting to enter ICSP programming mode ......................................................
16:24:39.961 -> Failed to enter programming mode. Double-check wiring!
16:24:39.961 -> Type 'C' when ready to continue with another chip ...
Failed to enter ICSP. Double check wiring...
So please, could you have any hint about how upgrade ATMEGA16U2?
Many thanks!
Almost have the customized file boards.txt required, but cant finish it withou a brief (?) question about fuses.
I understand that for creating the custom board for restoring ATMEGA 16U2 for UNO, Dmjlambert got information available for the UNO board in the original file "boards.txt" and made some required corrections.
I'm not sure about definition of values for low, high and extended fuses for creating these custom boards. Do I have to keep the one shown for the "main" chip of that board? I mean..
If I want to create the custom board for the ATMEGA 16U2 for an Arduino UNO, should I keep the fuses values shown on boards.txt for the ATMEGA 328 section?
Do I have to proceed in the same way for creating the custom board for the ATMEGA 16U2 for an Arduino MEGA, considering those fuses values shown on boards.txt for the ATMEGA 2560 section?
Below the Burning Bootloader Output. Got the famous "Yikes!...."
The same message for both MEGAs boards. Tried several times pressing "Burn Bootloader" just in case.
Should I try putting as programmer another MEGA (good board) instead of UNO?
PD: something useful for someone trying the same procedure. When saving your boards.txt customized, have to do it w/ ANSI code!
I've been 20 min exploring what was wrong inside the txt but the problem was there. STD coding appears like UTF-8