11

When trying to upload the blink sketch to my (unofficial) Arduino Uno, I get the following error:

avrdude ser_open() can't set com-state for "\\.\COM3"

I have programmed this Arduino before using this same laptop, but not for quite some time. I have not changed anything in the Arduino IDE in this time.

I have tried the following:

None of the above fixed the issue and all gave the same error as shown above (except when trying different USB ports which showed the error just for different COM ports).

EDIT: Just tried both the Uno and Nano on another computer and both worked fine. This confirms that both the arduinos and cables I'm using are working properly.

1

4 Answers 4

10

Maybe a Windows driver problem. Do your uno and nano use a ch340? (It is the component translating USB to uart (serial pins of atmega328). Windows has no software way to differenciate boards using this component. It is a common use on cheap clones to lower price. Official arduinos use a second atmega (atmega16u2 natively supporting usb) instead of the ch340. Allowing windows to identify the arduino model.

You should try to update your ch340 driver as you have the same problem with the 2 boards. here is the download page of the manufacturer (ch341ser.exe is the package you want)

You can also try to connect your board to an usb2 port as some problems (and solutions to try) are posted here (arduino forum) And even try to use an usb2 hub...

3
  • 2
    It was the driver. For reference, I uninstalled the driver using Device Manager, then plugged the Uno in again and it installed the correct CH430 driver for me automatically, which is exactly what it must have done on the other computer since there has never been an Arduino plugged in to it before.
    – rozzy
    Aug 14, 2018 at 20:29
  • 1
    Worked for me as well, I just uninstalled the driver and scanned for changes
    – Nesar
    Nov 22, 2020 at 3:45
  • Exactly! A windows update can wipe out the existing CH341 driver, so re-installing it will fix it. Just 1. uninstall from Device Manager, checking the box to include the driver, then 2. It will be automatically re-installed in a few seconds (or the next time you plug in the Arduino clone). May 27, 2023 at 17:44
2

I had the same problem, open the port under COM and LPT in your device manager. Then roll back driver so the PC uninstalls all updates to the driver. At this point uploading the code will give the "Windows does not recognize driver" or some error like that. Now just unplug and plug the UNO back in and update driver. This solved the problem for me. Hope this helps :)

1
  • For the records, the default/vanilla drivers should be by FTDI. They can be installed automatically by Windows, but it's not bundled with them out of the box (so you must be online, and have updates enabled).
    – mirh
    Apr 18, 2023 at 19:09
0

I had the same problem. I was able to upload a simple Blink example, but not my own program. And I thought there's no problem in my program, since I successfully tested it on other Arduino before. But actually, that was the problem. I had this in my program (for console logs):

void setup() {
  Serial.begin(9600);
}

Then I read that different Arduinos use different baud rates. Originally I tested it on Arduino Mega, but this time I wanted to upload it to "unofficial" Arduino Nano (for which you have to use ATmega328P (Old Bootloader) option when uploading).

Since I didn't need debug logs in my program anymore, I removed these 'Serial' commands completely. Then it got uploaded without problems.

A short article on this topic

-1

I have the same problem. I found it related to the card and not the PC. The offending card uses processor ATMEGA328P_U_TH (Image 1). The successful card uses a different processor ATMEGA328P_U (Image 2). I have NOT found a way to use the ATMEGA328P_U_TH card. It will not correctly connect to a PC and allow code to download from IDE to card.

Image 1 Image 1

Image 2 Image 2

2
  • 1
    the way more important difference is the USB chip. one has a FTDI chip or CH340, the other has Atmega16u2
    – Juraj
    May 10, 2023 at 14:48
  • Juraj, Thank you. The issue that I am experiencing is that the card with FTDI does not link to any PC. I made sure the CH340G driver code was loaded. Still unsuccessful. I'd like to find out why and make corrections. But, I do not have the time to go through the troubleshooting steps on my own.
    – StanB
    May 11, 2023 at 16:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.