I have been uploading sketches to my Arduino Mega 2560 for quite some time now, but after uploading a new sketch, I am unable to upload anything at all, including blank setup() and loop() functions. When uploading, I get upload output (verbose) like this:
Binary sketch size: 678 bytes (of a 258048 byte maximum)
C:\arduino-1.0\hardware/tools/avr/bin/avrdude -CC:\arduino-1.0\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cstk500v2 -P\\.\COM4 -b115200 -D -Uflash:w:C:\Users\HP\AppData\Local\Temp\build2486111564331036727.tmp\BareMinimum.cpp.hex:i
avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "C:\arduino-1.0\hardware/tools/avr/etc/avrdude.conf"
Using Port : \\.\COM4
Using Programmer : stk500v2
Overriding Baud Rate : 115200
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: Recv: . [1b]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [0b]
avrdude: Recv: . [0e]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [08]
avrdude: Recv: A [41]
avrdude: Recv: V [56]
avrdude: Recv: R [52]
avrdude: Recv: I [49]
avrdude: Recv: S [53]
avrdude: Recv: P [50]
avrdude: Recv: _ [5f]
avrdude: Recv: 2 [32]
avrdude: Recv: t [74]
avrdude: stk500v2_getsync(): found AVRISP programmer
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
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500V2
Description : Atmel STK500 Version 2.x firmware
Programmer Model: AVRISP
avrdude: Send: . [1b] . [02] . [00] . [02] . [0e] . [03] . [90] . [86]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: Send: . [1b] . [02] . [00] . [02] . [0e] . [03] . [90] . [86]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: Send: . [1b] . [02] . [00] . [02] . [0e] . [03] . [90] . [86]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
etc... (never gives up)
I have tried uploading the sketch from multiple computers (different OS's), and I even swapped out the Arduino. The new Arduino also refused to accept uploads after I uploaded my new sketch. I could try to upload onto a third, but I'd prefer to fix my two non-functional Arduinos first, and then I'll try to figure out why my code is breaking the Arduinos. If people think it would help, I could post the code, but it's very long and has mutliple .h and .cpp files.
I'm guessing the problem is with the bootloader, which I basically know nothing about. So if someone could point me in the right direction for fixing my Arduino, I'd really appreciate it.