Arduino Mega; Can't Upload

I’ve an Arduino mega, clone one. I can’t seem to upload code to it. It’s detecting in Windows device manager at COM 9. I’ve selected Arduino/Genuino Mega or Mega 2560 as board and COM 9 as COM port. I’ve been able to upload codes before, so bootloader is there. Also When I make USB connection L LED is blinking 4 or 5 times. I shows “Uploading” for what seems like an eternity and finally shows an error.

I’ve done loop back test using Hype!Terminal by Connecting GND and RESET, and connecting TX and RX pins. It returns whatever I type in the serial window and not showing anything when I disconnect TX and RX line. So CH340G(USB TTL chip) should be okay.

Error Message
Note: I cant post entire error(more than maximum allowed word length)
Please I’ve posted it in Stack Exchange

    avrdude: AVR device initialized and ready to accept instructions
    
    Reading | ################################################## | 100% 0.01s
    
    avrdude: Device signature = 0x1e9801 (probably m2560)
    avrdude: reading input file "C:\Users\NEWUSE~1\AppData\Local\Temp\arduino_build_740583/Blink.ino.hex"
    avrdude: writing flash (1470 bytes):
    
    Writing | ########avrdude: ser_send(): write error: sorry no info avail
    avrdude: stk500_send(): failed to send command to serial port
    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_ReceiveMessage(): timeout
    avrdude: stk500v2_getsync(): timeout communicating with programmer
    avrdude: ser_send(): write error: sorry no info avail
    avrdude: stk500_send(): failed to send command to serial port
    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_ReceiveMessage(): timeout
    avrdude: stk500v2_getsync(): timeout communicating with programmer
    avrdude: ser_send(): write error: sorry no info avail
    avrdude: stk500_send(): failed to send command to serial port
    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_ReceiveMessage(): timeout
    avrdude: stk500v2_getsync(): timeout communicating with programmer
    avrdude: ser_send(): write error: sorry no info avail
    avrdude: stk500_send(): failed to send command to serial port
    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_ReceiveMessage(): timeout
    avrdude: stk500v2_getsync(): timeout communicating with programmer
    avrdude: ser_send(): write error: sorry no info avail
    avrdude: stk500_send(): failed to send command to serial port
    avrdude: stk500v2_ReceiveMessage(): timeout
    avrdude: stk500v2_ReceiveMessage(): timeout
    the selected serial port avrdude: stk500v2_ReceiveMessage(): timeout
     does not exist or your board is not connected

2.png

After some time spending with it. Turns out If I change my USB port and connect it another USB port, Mega detects in the new Port as COM 6. I can upload codes to the Mega using this COM port(COM6), though it shows error sometimes. But if I change it back to previous USB port(Here Mega detected as connected in COM9), I can't upload anything. You can see the error message in the above link. I also have a UNO and tried uploading code to it through the same USB port(here it detects in COM8), I can upload code.

I used working COM(COM6) to upload Marlin FW to the Mega and I can connect my printer through same COM port(COM6), but if I tried it through COM9 I can't connect.

So why can't I use COM 9???

PS: I've been using COM9 to communicate with the Same Mega

Watch out for USB 3.0 port issues !
It is a known issue but not with all USB 3.0 chipsets.

First and easiest work around is to insert a decent powered USB 2.0 HOB between the USB 3.0 port and the Arduino.
Second work around is to roll back a microsoft driver to the motherboards own driver.
Third fix is to change the USB settings in the BIOS to the middle speed compatible with USB 2.0.

Set the environment variable DevMgr_Show_NonPresent_Devices to 1 so that you can see disconnected devices when displaying hidden devices in Device Manager.

By that way you can “remove” disconnected devices. It is a good thing to do a clean up in registry too.

Disconnect devices. Remove every COM port disconnected. Connect again.

The information given by ptnapivoski is normally only needed with the windows com port bug above COM 30.

When removing those unwanted COM ports you will normally also be offered an option to remove drivers.
I would suggest you do not take that option unless you have known driver issues.

Otherwise it is good advice and can be very useful if you use lots of Arduino type items.

ballscrewbob:
Watch out for USB 3.0 port issues !
It is a known issue but not with all USB 3.0 chipsets.

First and easiest work around is to insert a decent powered USB 2.0 HOB between the USB 3.0 port and the Arduino.
Second work around is to roll back a microsoft driver to the motherboards own driver.
Third fix is to change the USB settings in the BIOS to the middle speed compatible with USB 2.0.

COM9 is actually USB3.0. I could successfully make loop back test with both ports. But only upload code through COM6.

But my Arduino UNo works with usb3.0, here it detected as connected in COM8

Why's that?

ptnapivoski:
Set the environment variable DevMgr_Show_NonPresent_Devices to 1 so that you can see disconnected devices when displaying hidden devices in Device Manager.

By that way you can “remove” disconnected devices. It is a good thing to do a clean up in registry too.

Disconnect devices. Remove every COM port disconnected. Connect again.

Can you tell me how to do that?

KB315539