Accidentally unplugged USB during upload, now no sketch can be uploaded. Help!

Hi all,

My Arduino Mega 2560 has been working fine until I accidentally unplugged the USB cable (also serving as the only power source) in the middle of upload. Now, even the simplest "blink" sketch cannot be uploaded. Please see error code at below.

I have tried various ways found online, and none of them resolve the issue. Did the unplugging corrupted the Arduino?

Please help!

  • Disconnect USB (and power), wait for a few minutes, then reconnect
  • Press reset while code compiling is almost done
  • Used device manager to check COM port selected is correct (in this case COM7)
  • Checked correct board and processor
  • Tried different port
  • Sketch can be loaded to a different Mega
Sketch uses 1470 bytes (0%) of program storage space. Maximum is 253952 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 8183 bytes for local variables. Maximum is 8192 bytes.
avrdude: ser_open(): can't open device "\\.\COM7": The system cannot find the file specified.


avrdude: ser_drain(): read error: The handle is invalid.


avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
the selected serial port avrdude: stk500v2_getsync(): timeout communicating with programmer
 does not exist or your board is not connected

Select the port of the Mega from the Arduino IDE's Tools > Port menu. If no port appears for the Mega with it plugged in to your computer then try restarting your computer.

Hi Pert,

I did try that. I checked that the correct port is selected in Arduino IDE, and cross check to ensure this is correct on device manager.

IDE actually detects presence of the board when no sketch is being uploaded. It shows correct board type and port number, it can even Get Board Info.