Install, then the first upload · 02 of 33

The CH340 driver

The computer talks to this board through a CH340C, and it needs a driver for that chip. Many computers already have one. If no port appears when you plug the board in, install the latest driver from WCH, the company that makes the chip.

Your board

Why a driver

The ATmega328P has no USB. The CH340C next to the USB-C socket does that job: to the computer it is a USB serial port, and on the board it is two wires into pins 0 and 1. The computer needs a driver for that chip before it lists a port, and the board needs a port before anything can be uploaded to it.

A driver is not always missing. Linux carries one in its kernel, recent macOS versions ship one, and Windows Update often installs one the first time the board is plugged in. So plug in first, and look.

Plug in, and look

What your computer shows
Windows, working
Your computer
What happened
ON lamp
lit
Port
listed
Driver to install
CH341SER, from WCH
A COM port with CH340 in its name is the board. The number is Windows’ choice and can change with the USB socket. Windows Update often installs the driver by itself the first time the board is plugged in.

Pick your system and what happened. The ON lamp lights whatever the driver does, because the cable carries power either way: ON tells you about power and nothing about the port.

The port's name is the computer's choice, not the board's:

  • Windows: COM3, COM4 and so on, listed in Device Manager under Ports (COM & LPT) as USB-SERIAL CH340.
  • macOS: /dev/cu.usbserial- and a number, or /dev/cu.wchusbserial and a number with WCH's driver.
  • Linux: /dev/ttyUSB0, or the next free number.

The reliable way to find it is the same everywhere: open the IDE's Tools > Port menu with the board unplugged, plug it in, and take the entry that appeared.

If no port appears: install the driver from WCH

First rule out the cable. A charge-only cable powers the board and has no data wires; nothing on the computer can fix that. Use a cable you have moved files over.

If a data cable still gives no port, install the CH340 driver from WCH, the chip's maker, at wch-ic.com, and take the latest version it offers rather than a copy from somewhere else:

  • Windows: the download named CH341SER.EXE (one driver covers the CH340 and CH341). Run it, press Install, then unplug the board and plug it back in. A COM port appears under Ports.
  • macOS: the CH34x macOS driver, which installs an app called CH34xVCPDriver. Open the app from Applications and press Install; macOS then asks you to allow the driver in System Settings, under Privacy and Security on most recent versions. Unplug the board and plug it back in.
  • Linux: nothing to install. The kernel's ch341 driver handles the CH340C and creates /dev/ttyUSB0.

Two Linux snags

Linux has the driver; what goes wrong is who gets the port. On some Ubuntu releases, 22.04 among them, a braille-display service called brltty claims USB serial adapters as they appear, and the port vanishes a second after it is made. sudo dmesg shows it:

ch341-uart converter now attached to ttyUSB0
usbfs: interface 0 claimed by ch341 while 'brltty' sets config #1

If nobody uses a braille display on that computer, remove the brltty package and plug the board in again. The second snag is permission: the port belongs to a group your user may not be in, which is dialout on Ubuntu and Debian.

sudo usermod -aG dialout "$USER"   # then log out and back in

Once a port appears, the rest of the setup is two rows in a menu: board and port.

When it does not work

No port appears, and the ON lamp is lit

Try a different cable first: a charge-only cable lights ON and carries no data. Then a different USB socket, without a hub. If the port is still missing, install the latest CH340 driver from wch-ic.com, restart if the installer asks, and plug the board in again.

macOS installed the driver and still shows no port

The driver is installed but not allowed yet. Open the CH34xVCPDriver app from Applications and press Install, then look in System Settings, Privacy and Security (on recent macOS, also General, Login Items and Extensions) for a request to allow it. Unplug the board and plug it back in.

On Linux the port appears and then disappears

On some Ubuntu releases, 22.04 among them, the braille-display service brltty claims USB serial adapters, and dmesg shows a line naming brltty right after the ch341 line. If nobody on the computer uses a braille display, remove the brltty package and plug the board in again.

Permission denied when uploading on Linux

The port exists and your user may not open it. On Ubuntu and Debian the port belongs to the dialout group: add yourself with sudo usermod -aG dialout followed by your user name, then log out and back in.

Two entries appear on a Mac with the same number

macOS lists every serial device twice, once as tty. and once as cu. Choose the cu. one. If both usbserial and wchusbserial entries appear, two drivers are installed and either will work.

Where this goes next

The two rows in the Tools menu that decide whether an upload reaches this board.

Board and port →

Edit this page — content/books/atmega328p/the-ch340-driver.mdx

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum →