Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.
Upload error · Windows driver

Fix “avrdude: ser_open(): can't set com-state for \\.\COM4”

Windows can't configure the USB-serial port — usually an outdated or fake-chip-incompatible CH340 driver. Reinstall the WCH driver, replug, and try another port.

Arduino Nano (CH340 clone)Arduino Uno (clone)Arduino Mega 2560 (clone)Updated 3 Nov 2026

Community draft — report a mistake

What you see

OutputOutput
Sketch uses 1030 bytes (3%) 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: ser_open(): can't set com-state for "\\.\COM4"

Failed uploading: uploading error: exit status 1

Before talking to the bootloader, avrdude asks Windows to set the port’s speed and control lines. “can’t set com-state” means the driver refused. The port exists, but the driver behind it isn’t working properly.

On clone boards with a CH340 chip, a clean reinstall of the current WCH driver fixes it almost every time.

Quick fix — try in order

  1. 1

    Reinstall the CH340 driver from WCH

    Download CH341SER from wch-ic.com (link below), click Uninstall, then Install. Unplug and replug the board.

  2. 2

    Remove the old driver completely if that fails

    Device Manager → Ports → USB-SERIAL CH340 → Uninstall device → tick “Delete the driver software”. Reboot, then install the WCH driver fresh.

  3. 3

    Try another USB port and cable

    A device that half-enumerates (loose cable) also refuses configuration.

  4. 4

    Close serial tools before uploading

    A program that opened the port with unusual settings can leave it in a state avrdude can't change. Close it and replug.

Why it happens

What is the “com-state”?

Baud rate, data bits, parity and handshake lines. avrdude sets them through the driver. If the driver rejects the request, avrdude can't continue.

Why mostly CH340 clones?

Some Windows Update driver versions and some counterfeit CH340 chips don't get along. The current WCH driver handles both genuine and clone chips best.

Board-specific notes

Arduino Nano clone on Windows 11: If the driver installs but the error remains, try the older CH341SER 3.5 driver from WCH's archive; some early clone chips only work with it.

Drivers — official sources only

↑↓ to move · Enter to open