3

I am working with an Arduino Uno clone that uses the CH340G USB to TTL converter in lieu of the 16U2 found on the Uno. I see that most tutorials suggest downloading the CH340G drivers from what they call "a chinese website". I don't quite trust that site, is there any more trustworthy website where one might be able to acquire CH340G drivers for a modern Linux distro (preferably CentOS or Debian).

I ask here because devices with that chip seem to be popular in the Arduino community. If the unix stackexchange site would be a better place to ask then the question can be moved. Thank you.

EDIT: Apparently my system is having an issue with recognizing the device. Here are some specs:

$ lsusb
Bus 002 Device 002: ID 8087:8000 Intel Corp. 
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 004: ID 04d9:3015 Holtek Semiconductor, Inc. 
Bus 003 Device 003: ID 0cf3:9271 Atheros Communications, Inc. AR9271 802.11n
Bus 003 Device 012: ID 045e:0040 Microsoft Corp. Wheel Mouse Optical
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

$ lsusb | wc -l
9

$ # Now I plug in the Uno clone
$ # Wait about a minute just to be sure...
$ lsusb
Bus 002 Device 002: ID 8087:8000 Intel Corp. 
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 004: ID 04d9:3015 Holtek Semiconductor, Inc. 
Bus 003 Device 003: ID 0cf3:9271 Atheros Communications, Inc. AR9271 802.11n
Bus 003 Device 012: ID 045e:0040 Microsoft Corp. Wheel Mouse Optical
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
$ lsusb | wc -l
9

$ uname -a
Linux happiness 4.4.0-47-generic #68-Ubuntu SMP Wed Oct 26 19:39:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/issue
Ubuntu 16.04.1 LTS \n \l

My entire dmesg file can be found on pastebin, here is the end of it:

[37253.943739] usb 3-6: device descriptor read/64, error -71
[37254.159669] usb 3-6: new full-speed USB device number 15 using xhci_hcd
[37254.159841] usb 3-6: Device not responding to setup address.
[37254.363858] usb 3-6: Device not responding to setup address.
[37254.567744] usb 3-6: device not accepting address 15, error -71
[37254.679654] usb 3-6: new full-speed USB device number 16 using xhci_hcd
[37254.679756] usb 3-6: Device not responding to setup address.
[37254.883917] usb 3-6: Device not responding to setup address.
[37255.087716] usb 3-6: device not accepting address 16, error -71
[37255.087749] usb usb3-port6: unable to enumerate USB device
10
  • 3
    That "Chinese website" is the manufacturer's web site. Can't be more authoritative than that...
    – dda
    Commented Jan 6, 2017 at 16:55
  • 2
    Drivers...? for Linux...?!?! What are they?!
    – Majenko
    Commented Jan 6, 2017 at 17:07
  • 2
    Indeed, you should not download drivers from random websites for a Linux system, not only as matter of safe practices but also because it is unlikely that they would be usable. USB serial converters for Linux are handled by kernel modules and those need to be compiled for the specific kernel in use or its close relative. Modern Linux distros likely support the CH340G already as the driver is included in the official kernel source, if not you should pursue obtaining a suitable kernel module from the provider of your distro or get the upsteam or distro kernel sources and compile the module. Commented Jan 6, 2017 at 17:16
  • 1
    It's more likely that the CH340G chip is dead, or that the crystal driving it isn't accurate enough.
    – Majenko
    Commented Jan 6, 2017 at 18:32
  • 1
    I think you really don't get it: That strange chinese "not-trustworthy website" all tutorials recommend, is the homepage of the manufacturer! So, no matter if windows, linux, mac, or android, it will be hard to find alternative drivers.
    – peterfalk
    Commented Dec 12, 2022 at 6:21

2 Answers 2

5

Linux doesn't need drivers (indeed, the whole concept is pretty alien to Linux users).

The CH340G is fully supported by the default kernel in all distros I have ever used. On my Ubuntu machine the CH340G on my NodeMCU is detected automatically:

[ 8195.450566] usb 4-1: new full-speed USB device number 2 using uhci_hcd
[ 8195.630710] usb 4-1: New USB device found, idVendor=1a86, idProduct=7523
[ 8195.630714] usb 4-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 8195.630716] usb 4-1: Product: USB2.0-Serial
[ 8196.675137] usbcore: registered new interface driver usbserial
[ 8196.675153] usbcore: registered new interface driver usbserial_generic
[ 8196.675166] usbserial: USB Serial support registered for generic
[ 8196.677581] usbcore: registered new interface driver ch341
[ 8196.677600] usbserial: USB Serial support registered for ch341-uart
[ 8196.677620] ch341 4-1:1.0: ch341-uart converter detected
[ 8196.690670] usb 4-1: ch341-uart converter now attached to ttyUSB0

Nothing to download, nothing to install, nothing to risk the security of your system with.

4
  • 5
    "Linux doesn't need drivers", then proceeds to post log showing how kernel loads dynamically three driver modules. I feel conflicted.
    – voneiden
    Commented Oct 9, 2018 at 6:08
  • @snaipperi Right, those come as part of the kernel itself. You can just as easily build a kernel with those drivers non-modular, or build an entirely monolithic kernel that doesn't use modules at all. Also, Kernel modules aren't always "drivers", various other internal workings like filesystems and even security management tools are implemented as kernel modules.
    – Kamilion
    Commented Apr 12, 2019 at 18:54
  • 1
    I was just nitpicking that the statement "linux doesn't need drivers" is incorrect. The ch341 module, regardless of being shipped with the kernel, is an interface driver and is very much needed by the kernel to be able to talk with the chip.
    – voneiden
    Commented Apr 13, 2019 at 19:33
  • I think what is attempted here is a statement that downloading drivers from a third-party site is pretty alien. If your distro does not already ship the driver as a kernel module, you would typically download the driver's source code and compile it against your kernel version (for which you then also need the source code); though of course, some distros already do this for some drivers, and package the result as an installable package. But it's not unheard of for a manufacturer to provide a downloadable device driver module for Linux (possibly even as closed source).
    – tripleee
    Commented Dec 12, 2022 at 6:27
1

"Linux doesn't need drivers (indeed, the whole concept is pretty alien to Linux users)."

I feel alienated, however this information is incorrect. I have at least two Ubuntu machines that did not recognize the CH340g chip. One is Linux Mint 18.2 32bit the other is a Linux Mint 19 64bit. I used the 'driver' that I downloaded from the site in question and guess what? It is the exact same driver that NodeMCU uses. For those that want or need to download the driver, but don't want to visit a 'suspicious site' just go here nodemcu-dev and you will find three flavors: Linux, MAC and Windows. Strange that they have an MIT license for their own software.

For Linux, just extract the archive CH341SER_LINUX.ZIP, then open a terminal in the directory and use make && sudo make then load the module ahem.. driver with (may need to use sudo) insmod /{path-to-your-extracted-folder}/ch34x.ko or reboot.

Now, I am not arguing whether or not Linux comes with the module, because I see two (one for each kernel) on just one of my systems located at /lib/modules/{x.x.x-xx}-generic/kernel/drivers/usb/serial/ch341.ko, however the one that is needed comes from the Chinese site in question that happens to be the same place where NodeMCU got theirs (or possibly some other site) for it to be recognized.

Also, I don't get how someone can buy Chinese products (or from anywhere else) and be afraid to visit their site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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