Hi, I use currently an Arduino Nano (ATmega 328P Old Version) which works fine with a COM4 connection from a USB Port.
The issue is, i bought annother Arduino Nano, actually 2 more, and once i try to upload the same Sketch, through the same USB Port, some COM 4 config, returns the following error:
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "D:\Alvaro\99.Proyecto_Rally\Software\Arduino\hardware\tools\avr/etc/avrdude.conf"
Using Port : COM4
Using Programmer : arduino
Overriding Baud Rate : 57600
Beim Hochladen des Sketches ist ein Fehler aufgetreten
avrdude: ser_open(): can't set com-state for "\.\COM4"
avrdude done. Thank you.
If i swap to my "old" Arduino nano, changing nothing on arduino configurations, it works.
I´ve already search for similar issues, but i don´t find any solutions. Maybe you can help me in order to be able to use the new ones, or if it is an quality issue from my "new2 arduino nano, i can return them.
There were some previous reports of this "can't set com-state for ..." error occurring specifically associated with the presence of the CH340 USB chip that is commonly used on the cheap derivative boards. It seems that a driver upgrade included in a recent Windows update is the cause of this problem.
The affected users have reported that doing a "roll back" to an older version of the driver was an effective workaround. You can give that a try.
I'll provide instructions:
Open this tutorial from SparkFun in your browser: https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all#drivers-if-you-need-them ⓘ We are using this tutorial as a source for an older version of the CH340 drivers. Generally I recommend only obtaining drivers from the manufacturer of the device, but WCH does not provide older versions of their drivers and SparkFun is trustworthy.
Click the "Windows (EXE)" link you see in red under the "Drivers (If You Need Them)" section of the tutorial.
Wait for the download to finish.
Run the downloaded CH341SER.EXE file.
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 appear. 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.
Click the X icon at the top right of the "DriverSetup(X64)" dialog to close it.
Close Arduino IDE if it is running.
Connect the Arduino board to your computer with a USB cable.
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 (COM_n_)" under the "Ports (COM & LPT)" section (where "COM_n_" is some serial port e.g., COM4). Right click on that item.
A context menu will open.
Select the "Drivers" tab of the "USB-SERIAL CH340 (COM_n_) Properties" dialog.
You will see a "Roll Back Driver" button in the dialog. If it is not clickable, perform the following instructions:
Select "Update driver" from the context menu.
An "Update Drivers Device - USB-SERIAL CH340 (COM_n_)" dialog will open.
Click on "Search automatically for drivers" in the "Update Drivers Device - USB-SERIAL CH340 (COM_n_)" 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 thread to let me know. I'll provide alternative instructions you can follow.
Click the "Close" button in the "Update Drivers Device - USB-SERIAL CH340 (COM_n_)" dialog.
Click the "Roll Back Driver" button in the "USB-SERIAL CH340 (COM_n_) 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.
Click the "Close" button in the "USB-SERIAL CH340 (COM_n_) Properties" dialog.
Now start Arduino IDE again and repeat whatever you were doing before when you encountered that error. Please reply here to let us know whether the error still occurs.
Thank you a lot for the quick answer, it works properly, but in my case i change some of the steps, maybe because i use Windows 11, don´t kno exactly. What i did a little different was:
Step 6A: I had to uninstall the current driver with the install programm (uninstall button), otherwise it hadn´t allow me before presing the install button.
19.2 After the step " Search automatically for drivers" it just install the correct one, i didnt have to roll back the driver (it was in any case not selectable), but after this step, it change the old virtual port COM4 to COM3, i connect the device, start the arduino APP, i selected the new COM3 port, and it worked properly fine.
Again, thanks in advance, with the old driver i can upload the sketches in all arduino nano boards i have, so seems work also fine with board with a newer driver as well.
You are welcome. I'm glad it is working now. Thanks for taking the time to share your findings while following the instructions. I'm sure those who who have the same problem find this thread through their researches will be very grateful.
I have also experienced that sometimes there is different behavior around step (19) that requires some adjustment to the procedure. I didn't figure out exactly what the conditions are for that. The Windows driver "roll back" capability seems quite confusing to use. Fortunately so far all users I supported have managed to complete the procedure successfully despite the complexity.
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 (COM_n_)" under the "Ports (COM & LPT)" section (where "COM_n_" is some serial port e.g., COM4). Right click on that item.
A context menu will open.
Select the "Drivers" tab of the "USB-SERIAL CH340 (COM_n_) Properties" dialog.
Do you see "3.4.2014.8" after the "Driver Version" in that "USB-SERIAL CH340 (COM_n_) Properties" dialog?
The alternative workarounds I am aware of:
Buy a replacement Nano board from a reputable seller
This problem seems to be specific to the "Nano" derivative boards of questionable provenance. You definitely won't have this problem if you buy a real Arduino Nano board because the real Nano uses a different USB chip altogether.
This problem seems to be specific to the Windows driver for the WCH CH340 USB chip. So if you are able to use a computer running the Linux or macOS operating system then the problem should not occur.