System wide configuration file is "C:\Users\jkeen\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"
Using Port : COM4
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: ser_open(): can't set com-state for "\.\COM4"
avrdude done. Thank you.
Failed uploading: uploading error: exit status 1
So I'm on a brand new laptop. Trying to connect a nano I have already downloaded ch340. I keep getting this message what do I do?
In the Arduino IDE, you should see the COM port in the "tools" menu.
You can try another USB cable, or select the old bootloader in the "Tools / Processor" menu. Or try another USB port or try another computer.
I moved your topic to an appropriate forum category @pacific10.
In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.
Hi @pacific10. 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.
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 you can follow to do that:
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 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 (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.
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.
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.
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.
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 "C:\Users\jkeen\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"
Using Port : COM4
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xbd
But you now have a different error message Consider that progress
Overriding Baud Rate : 115200 indicates that you're using the "328P" option under tools / processors in the IDE. Try the "old bootloader" option and if that fails the 168 under tools / processors.
The approach by @ptillisch in post #11 is to determine if there is a bootloader and if yes, which one.
Writing | avrdude: stk500_recv(): programmer is not responding
######avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
If it did not flash, there is no bootloader on the 328P processor. Can you post a link to what you exactly bought. Or post a clear photo of the top so we can try to identify the microcontroller.
The usual solution is to (try to) burn the bootloader.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xe8
Sketch uses 444 bytes (1%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xe8
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xe8
This error might be caused by having the wrong port selected from the Tools > Port menu in Arduino IDE.
Please perform this experiment to verify that the port you have selected is your Arduino board:
Disconnect the USB cable of the Arduino board from your computer.
Select Tools > Port from the Arduino IDE menus.
Take note of the ports, if any, listed in the menu.
Close the Tools menu. The ports list is only updated when the Tools menu is re-opened, so this step is essential.
Connect the Arduino board to your computer with a USB cable.
Select Tools > Port from the Arduino IDE menus. - If a new port is listed in the menu, that is the port of your Arduino board.
Select that port from the menu and try uploading again.
If the upload still fails, or if no new port appeared after you plugged the Arduino board into your computer, add a reply here to let us know and we'll investigate the problem further.