Brand new, stuck with ser_open(): can't set com-state for "\\.\COM5"

I have little idea on what to do next, ive followed a few guides to the same error and i dont understand what this is or how to fix this.
all my output says is: Sketch uses 6144 bytes (20%) of program storage space. Maximum is 30720 bytes.
Global variables use 736 bytes (35%) of dynamic memory, leaving 1312 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't set com-state for "\.\COM5"
Failed uploading: uploading error: exit status 1

Welcome. You're not the first one that encounters this problem with clone boards.

It seems to be a problem with a certain batch of CH340 chips (maybe they are fake, one common point seems to be that that chip does not have a print on it).

Have a look at Port monitor error: command 'open' failed: Invalid serial port. Could not connect to COM serial port - #49 by ptillisch.

ill have a look thank you

I followed the guide, it worked but was taking forever to upload
its now saying the same thing as before
should i just follow the same steps as before or is something else going wrong?

Hi @vernthedragon.

I'm not sure I understood correctly what you mean by this. Please provide a more detailed description of what you mean by this in a reply on this forum thread to help us to understand it.

If you attempt to upload a sketch to your board now, does the upload still fail?

Yes it still fails with the same error as before

avrdude: ser_open(): can't set com-state for ".\COM5"
Failed uploading: uploading error: exit status 1

I followed the steps given from the link sent on the first reply

I'm going to ask you to provide some additional information that might help us to understand how to proceed.

Please do this:

  1. Connect the Arduino board to your computer with a USB cable.
  2. Open the Windows Device Manager.
  3. Select View > Devices by type from the Device Manager menus.
  4. Open the "View" menu.
  5. If there is a to the left of the "Show hidden devices" menu item, click on "Show hidden devices" to disable it.
  6. Open the "Ports (COM & LPT)" section of the Device Manager tree.
  7. 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.
  8. Select the "Drivers" tab of the "USB-SERIAL CH340 (COMn) Properties" dialog.

Now please reply here on the forum thread to tell us the version number you saw after "Driver Version" field in that "USB-SERIAL CH340 (COMn) Properties" dialog.

3.8.2023.2

image_2024-05-10_180203878

OK, this indicates something went wrong while you were following the instructions to "roll back" the driver. Version "3.8.2023.2" of the CH340 driver is incompatible with the "CH340" chip on your cheap Chinese Arduino derivative board. The goal is to install version "3.7.2022.01" of the driver, which is compatible with the chip on your board.

I'll provide the full instructions for performing the "roll back" procedure here. Please follow them very carefully:

  1. Click the following link to download the previous version of the driver from the chip manufacturer's website:
    https://www.wch-ic.com/downloads/file/65.html?time=2023-03-16%2022:57:59
  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.
      :exclamation: 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 the forum thread to let me 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 you will not encounter that "can't set com-state" error during the sketch upload.

Thank you for this. It solved my problem too.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.