I have an ATmega2560 which I was able to flash to until recently. All the symptoms point to broken hardware, but on the other hand I wasn't doing anything other than plugging/unplugging my board around the time of the issue.
My board is recognized properly by the Arduino IDE as a mega2560, but when trying to upload I get the following text (Extended output) (each timeout takes a long time):
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
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 : COM8
Using Programmer : wiring
Overriding Baud Rate : 115200
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude done. Thank you.
An error occurred while uploading the sketch
Other behavioral peculiarities surrounding this issue:
-The "L" light only blinks once on startup. i.e. this light pattern: 1111000011111111...
-The RX and TX lights never light, when programming or otherwise.
-Starting the Serial Monitor doesn't reset the Arduino.
What I've done:
-Tested flashing on another Arduino (worked)
-Tested RX/TX echo with Serial monitor (didn't work, no RX/TX lights)
-Tried flashing another program (didn't work, seems program agnostic)
-Removed all wires hooked up to my Arduino except for USB and tested (didn't work)
I think all these things point to the ATmega16U being busted on the Arduino, information which I found from other points on the internet. But I want to troubleshoot this more instead of throwing my hands up and buying a new one (which is indeed the step after this). Can anyone offer advice on what the issue may exactly be and troubleshooting steps?
I did indeed try loopback previously, including wiring reset to ground. I was unable to see anything I typed on Serial Monitor echoed back (I was actually clicking Send too of course), and the RX/TX lights never lit.
I decided to try loopback with a Nano I had at my disposal as well, and I actually saw some unexpected results. I wasn't able to see any echo on the Nano either, but I did see its RX/TX lights blink momentarily whenever I clicked send.
When I plug in my Mega or Nano, Device Manager updates under the Ports menu with the following name:
Nano: "USB-SERIAL CH340 (COM4)"
Mega: "Arduino Mega 2560 (COM8)"
Note that I can upload to my Nano just fine currently, though loopback seems to not work with it. The actual uploading problem is only on the Mega.
Any diagnoses for this issue? I still think it's probably the ATmega16U, but I don't know how I'd go about testing/debugging that further.
Edit: I made a mistake in this wiring, D11, D12, and D13 aren't MOSI/MISO/SCK on the Mega2560. See my post below for correct wiring.
Nano | Mega
------+------
D10 | Reset
D11 | D11
D12 | D12
D13 | D13
GND | GND
5V | 5V
10uF capacitor between Nano reset and GND
After wiring was complete I set my board to Arduino Nano and port to the Nano's port (it was the only one plugged in anyway), and flashed ArduinoISP.
Then I set my board to Arduino Mega, keeping the port the same, and tried Burn Bootloader. I failed with invalid device signature (0x000000).
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
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
AVR Part : ATmega2560
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 4096 8 0 9000 9000 0x00 0x00
flash 65 10 256 0 yes 262144 256 1024 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 = 0x000000 (retrying)
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000 (retrying)
Error while burning bootloader.
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
Just in case the guide was wrong, I also tried keeping the board as Nano and burning bootloader and plugging in the Mega and electing its port before burning bootloader. Neither was the correct configuration, I think it was right albeit non-functioning the first time.
This is just more information to hopefully narrow down the problem. If anyone knows exactly what this set of failures is representative of, your help would be greatly appreciated
Realized my folly with that previous post. D11,D12, and D13 aren't the serial pins for the Mega. Wiring should be as follows instead.
Nano | Mega
------+------
D10 | Reset
D11 | D51
D12 | D50
D13 | D52
GND | GND
5V | 5V
10uF capacitor between Nano reset and GND
With this done, I was able to burn the bootloader. It seems to me that the problem resides in the USB to Serial controller on my Mega2560 then, which was bypassed by this.
Now I'm at least close to salvaging the Mega, fully functional or not. I just seem to be missing one step, maybe it's an obvious one - is there a way to use my ISP Nano to just flash programs onto my Mega in the Arduino IDE?
The bootloader has no impact to the problem. The bootloader resides in the ATmega2560 chip and it serve programming via serial port on ATmega2560. On-board USB/serial transceiver is ATmega16U2 (if genuine). No activity on Tx/Rx LEDs or better no successful loopback test means that no data can reach the ATmega2560's serial port. Things which can affect this are: driver on PC, USB cable, HW problem with USB/serial circuit, SW problem (if genuine Arduino - ATmega16U2 has firmware which can be corrupted).
You can program the Mega via ISP. It is not only for bootloading. The bootloader is just normal program as sketch is also.
Budvar10:
The bootloader has no impact to the problem. The bootloader resides in the ATmega2560 chip and it serve programming via serial port on ATmega2560. On-board USB/serial transceiver is ATmega16U2 (if genuine). No activity on Tx/Rx LEDs or better no successful loopback test means that no data can reach the ATmega2560's serial port. Things which can affect this are: driver on PC, USB cable, HW problem with USB/serial circuit, SW problem (if genuine Arduino - ATmega16U2 has firmware which can be corrupted).
You can program the Mega via ISP. It is not only for bootloading. The bootloader is just normal program as sketch is also.
The bootloader burn test was intended to rule out some of the problems. Seems like it's a HW problem with the USB/serial circuit given all the information (I ruled out the USB cable because I have two of them and they both work fine with other hardware).
Anyway, you said:
"You can program the Mega via ISP. It is not only for bootloading. The bootloader is just normal program as sketch is also."
I must be missing something - how exactly do you do this in the Arduino IDE? Or do I have to use avrdude manually instead?
Ah, that last command is what I was missing. With the programmer setup, flashing to the Mega seems to work fine now. It's a bit roundabout, but this solution should work for my purposes.
I got a Mega2560 wifi, which would not receive the upload.
Switched the RX TX micro switch at the board to RXD3 - TXD3
USB driver CH340 at com19 set to 115200 baud rate.
Board set to Arduino Mega or Mega2560
Programmer ArduinoISP.
fungreenfox:
I got a Mega2560 wifi, which would not receive the upload.
Switched the RX TX micro switch at the board to RXD3 - TXD3
USB driver CH340 at com19 set to 115200 baud rate.
Board set to Arduino Mega or Mega2560
Programmer ArduinoISP.
Then it uploaded without timeout.
This is the one and only answer that I have found after several hours of searching which works. Thank you very much!