Just out of interest I have just come across this problem too. I have several nanos 4 of which have unmarked CH340C chips and 3 which have the marked chips. All 4 unmarked chips have now started to fail uploading. All 3 marked chips are fine.
The error given is: avrdude: ser_open(): can't set com-state for "\.\COM13"
This error is given whichever port I use above or below Com8. One of the failing chips is part of a batch of five still in their anti-static packs.
I have tried these 4 on a windows 10 machine and a windows 11 machine both of which have been used to program and update 3 of the failed chips.
I have checked all my settings and they are correct.
So here is the "BUT" if I use my Raspberry Pi 4B (PC) all seven Nanos program perfectly. I also have an old MacBook Pro running Linux Mint which also programs them.
So, sorry not really a resolution but maybe someone out there can find a fix.
I've just ordered an ISP, ASP, AVR programmer. Hopefully that will work and I can stay on one PC.
Hi @cckspe. This "can't set com-state for ..." 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 driver for Windows.
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:
- 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 - Wait for the download to finish.
- Run the downloaded
CH341SER.EXEfile. - 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.
- A "DriverSetup(X64)" dialog will open. Click the "INSTALL" button in the dialog.
- Wait for the driver installation to finish, as indicated by the appearance of a "Driver install success!" dialog.
- Click the "OK" button in the "Driver install success!" dialog.
The dialog will close. - Click the X icon at the top right of the "DriverSetup(X64)" dialog
The dialog will close. - Close Arduino IDE if it is running.
- Connect the Arduino board to your computer with a USB cable.
- Open the Windows Device Manager.
- Select View > Devices by type from the Device Manager menus.
- Open the "View" menu.
- If there is a ✓ to the left of the "Show hidden devices" menu item, click on "Show hidden devices" to disable it.
- Open the "Ports (COM & LPT)" section of the Device Manager tree.
- 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. - Select the "Driver" tab of the "USB-SERIAL CH340 (COMn) Properties" dialog.
- You will see a "Roll Back Driver" button in the dialog. If it is not clickable, perform the following instructions:
- Click the "Update driver" button.
An "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog will open. - Click on "Search automatically for drivers" in the "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog.
- 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.
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 topic to let me know. I'll provide alternative instructions you can follow. - Click the "Close" button in the "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog.
The dialog will close.
- Click the "Update driver" button.
- Click the "Roll Back Driver" button in the "USB-SERIAL CH340 (COMn) Properties" dialog.
The "Driver Package rollback" dialog will open. - Click the radio button next to "My apps don't work with this driver" in the "Driver Package rollback" dialog .
- Click the "Yes" button.
The "Driver Package rollback" dialog will close. - 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.
That is because the problem is caused by an incompatibility with the Windows driver.
Hi ptillisch, thanks for your reply. I have been through this before as far as the roll back but as I think you suspected the Roll Back button is indeed not clickable. Any further help you can give will be greatly appreciated. I understand the incompatibility issue and assume that it's due to CH340 driver updates as they won't be wanting their chips cloned but it's a pain to old geezers like me ![]()
I have found that when the driver installation gets into this state, it can be solved by uninstalling and then reinstalling the drivers. After that, the "roll back" option should be enabled.
I'll provide instructions you can follow to do that:
- Close Arduino IDE if it is running.
- Connect the Arduino board to your computer with a USB cable.
- Open the Windows Device Manager.
- Select View > Devices by type from the Device Manager menus.
- Open the "View" menu.
- If there is a ✓ to the left of the "Show hidden devices" menu item, click on "Show hidden devices" to disable it.
- Open the "Ports (COM & LPT)" section of the Device Manager tree.
- 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. - Select the "Driver" tab of the "USB-SERIAL CH340 (COMn) Properties" dialog.
- Click the "Uninstall Device" button.
The "Uninstall Device" dialog will open. - Check the box next to "☐ Attempt to remove the driver for this device.".
- Click the "Uninstall" button.
The "Uninstall Device" and "USB-SERIAL CH340 (COMn) Properties" dialogs will close. - Disconnect the USB cable of the Arduino board from your computer.
- Reconnect the USB cable of the Arduino board to your computer.
- Wait for the "USB-SERIAL CH340 (COMn)" device to appear under the "Ports (COM & LPT)" section of the Device Manager tree.
This will take a couple of minutes as Windows must first automatically reinstall the driver.
It might appear first as a "USB2.0-Serial" device under the "Other devices section of the tree. Just wait for a little longer and it will appear in its final place under the "Ports (COM & LPT)" section. - 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 - Wait for the download to finish.
- Run the downloaded
CH341SER.EXEfile. - 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.
- A "DriverSetup(X64)" dialog will open. Click the "INSTALL" button in the dialog.
- Wait for the driver installation to finish, as indicated by the appearance of a "Driver install success!" dialog.
- Click the "OK" button in the "Driver install success!" dialog.
The dialog will close. - Click the X icon at the top right of the "DriverSetup(X64)" dialog.
The dialog will close. - Switch back to the Windows "Device Manager".
- Double click on the "USB-SERIAL CH340 (COMn)" device under the "Ports (COM & LPT)" section.
The "USB-SERIAL CH340 (COMn) Properties" dialog will open. - Select the "Driver" tab of the "USB-SERIAL CH340 (COMn) Properties" dialog.
- Click the "Update driver" button.
An "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog will open. - Click on "Search automatically for drivers" in the "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog.
- 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.
- Click the "Close" button in the "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog.
The dialog will close. - Click the "Roll Back Driver" button in the "USB-SERIAL CH340 (COMn) Properties" dialog.
The "Driver Package rollback" dialog will open. - Click the radio button next to "My apps don't work with this driver" in the "Driver Package rollback" dialog .
- Click the "Yes" button.
The "Driver Package rollback" dialog will close. - 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.
Hi ptillisch, thanks for your quick reply AND the solution to my problem. I had partialy worked my way through this but the Roll Back Button had me stumped. I have used many of these Nanos in model Railway equipment in my local club so not being able to access them could have been a real potential problem for me.
Kindest Regards cckspe.
You are welcome. I'm glad it is working now.
Regards, Per
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.