COM port recognized, but uploads fail

Hello,

I’m new to Arduino and working with an Elegoo Mega 2560 from the starter kit. I’ve been trying to get the basic Blink sketch uploaded, but I keep hitting the same error. I could use some help troubleshooting because I'm getting a little frustrated here.

I've used ChatGPT to help me troubleshoot and I've spent a good two hours now trying to get the blink training program to work. Here's what I've done:

  • Installed the CH340 drivers (multiple versions, including the recommended ones).
  • Uninstalled and reinstalled the drivers via Device Manager.
  • Moved the board between both USB ports on my laptop.
  • Tried two different USB cables
  • Changed the COM port number in Device Manager (tried COM7, COM9).
  • Made sure Serial Monitor and Serial Plotter are closed.
  • Restarted the IDE, ran it as administrator, reinstalled the Arduino AVR Boards package.
  • Tried tapping/resetting the board at “Uploading…” time.
  • Tried changing bit per second speed to 115200 under advanced settings under the com port in device settings (saw someone else try that and it worked for them)

None of that has worked.

Here is what is working:

  • The board powers on (green ON LED).
  • The built-in orange L LED is flashing.
  • In Device Manager, Windows correctly shows USB-SERIAL CH330 (COM9)
  • In Arduino IDE, Tools → Port** shows the same COM number (with “Arduino Mega 2560”).

Whenever I try to upload Blink, I get this error

Sketch uses 1536 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 set com-state for "\.\COM9"
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
Failed uploading: uploading error: exit status 1

I'm really not sure what to do next. ChatGPT thinks it could be a hardware issue and I'm really hoping it's just something simple because I'm such a novice. I gotta say, as an adult trying to work with a kids starter kit, this experience has been equal parts humbling and frustrating.

Thanks,

WB

Hi @wallabear.

This error occurs when uploading to the boards that use specific batches of the WCH CH340 USB chip. The problem only occurs when using the latest version of the CH340 Windows driver.

The workaround for the problem is to perform a "roll back" to an older version of the driver that is compatible with these problematic "CH340" chips. I'll provide instructions you can follow to do that:

  1. Click the following link to download the previous version of the driver from an archive of the chip manufacturer's website:
    https://web.archive.org/web/20220519153932/https://www.wch-ic.com/downloads/file/65.html
  2. Wait for the download to finish.
  3. Run the downloaded CH341SER.EXE file.
  4. A "User Account Control" dialog may now appear asking "Do you want to allow this app to make changes to your device?". Click the "Yes" button.
  5. A "DriverSetup(X64)" dialog will open. Click the "INSTALL" button in the dialog.
  6. Wait for the driver installation to finish, as indicated by the appearance of a "Driver install success!" dialog.
  7. Click the "OK" button in the "Driver install success!" dialog.
    The dialog will close.
  8. Click the X icon at the top right of the "DriverSetup(X64)" dialog
    The dialog will close.
  9. Close Arduino IDE if it is running.
  10. Connect the Arduino board to your computer with a USB cable.
  11. Open the Windows Device Manager.
  12. Select View > Devices by type from the Device Manager menus.
  13. Open the "View" menu.
  14. If there is a to the left of the "Show hidden devices" menu item, click on "Show hidden devices" to disable it.
  15. Open the "Ports (COM & LPT)" section of the Device Manager tree.
  16. You should see a port identified as "USB-SERIAL CH340 (COMn)" under the "Ports (COM & LPT)" section (where "COMn" is some serial port e.g., COM4). Double click on that item.
    The "USB-SERIAL CH340 (COMn) Properties" dialog will open.
  17. Select the "Driver" tab of the "USB-SERIAL CH340 (COMn) Properties" dialog.
  18. You will see a "Roll Back Driver" button in the dialog. If it is not clickable, perform the following instructions:
    1. Click the "Update driver" button.
      An "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog will open.
    2. Click on "Search automatically for drivers" in the "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog.
    3. You should now see the driver installation wizard update the driver. Wait for the update to finish, as indicated by the message "Windows has successfully updated your drivers" in the dialog.
      :red_exclamation_mark: It is possible you will instead see the message "The best drivers are already installed". If so, please stop following the instructions here and reply on this forum topic to let us know. I'll provide alternative instructions you can follow.
    4. Click the "Close" button in the "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog.
      The dialog will close.
  19. Click the "Roll Back Driver" button in the "USB-SERIAL CH340 (COMn) Properties" dialog.
    The "Driver Package rollback" dialog will open.
  20. Click the radio button next to "My apps don't work with this driver" in the "Driver Package rollback" dialog .
  21. Click the "Yes" button.
    The "Driver Package rollback" dialog will close.
  22. Click the "Close" button in the "USB-SERIAL CH340 (COMn) Properties" dialog.

Now start Arduino IDE again and repeat whatever you were doing before when you encountered that error before. Hopefully this time everything will work as expected.

The Starter Kit section on this forum is specific for the Arduino Starter Kit and hence your topic has been moved.

One of the drawbacks of using a clone to start with.

When starting out, you really need to have something that works out of the box, and that usually means buying a genuine Arduino product. A new Nano isn't that expensive, but at least it gives you the confidence you want when starting out.

1 Like