Contents
How to fix error “avrdude: ser_open(): can’t set com-state for “\. \COMx”. This error comes when we try to upload the sketch to a compatible Arduino board (clone), especially with an old bootloader using Arduino IDE 2.x (I use the 2.3.2 version) in Windows 11 OS. This board is usually equipped with USB driver CH340 which is cheaper than the original one, Atmel Atmega ‘u’ series (Atmega16u2, Atmega 32u4, and so on). But don’t worry. You might try this solution if you find this error while uploading a sketch to your Arduino board.
Error in Arduino IDE 2.x
Here is the error in the ‘Output’ Terminal of the IDE
Solution Avrdude can’t set COMx
You must update the Windows USB driver of the CH340/CH341 chipset to 3.7.x version or the latest. You can download this driver in here
How to Fix
Please update the new driver by double click the installer in the URL link above, then click the ‘Install’ button like the picture below
Please wait a few minutes, then your USB driver will update with the one. Once updated, you can check the new driver in the Device Manager utility (Control Panel) below
To ensure the new driver is ready to work, you must restart your laptop
Try Arduino IDE 2.3.2
After restarting your laptop, you can try the new CH340 USB driver. Now, we will try to upload a sketch in a compatible Arduino Nano (Chinese CH340 board). Open the IDE then choose the menu ‘Tools-Board (select ‘Arduino Nano’), select the correct COM port of the board then select the processor ‘ATmega328P (Old Bootloader)’ it the Tools-Processor menu (see the picture below)
Then click the ‘Upload’ button (or press the CTRL+U keyboard button), then the sketch will be uploaded normally
Congratz 😁
a Technopreneur – writer – Enthusiastic about learning AI, IoT, Robotics, Raspberry Pi, Arduino, ESP8266, Delphi, Python, Javascript, PHP, etc. Founder of startup Indomaker.com