Skip to content
master
Switch branches/tags
Code

Files

Permalink
Failed to load latest commit information.

CH341SER driver

  1. About driver
  2. Changes
  3. Tests
  4. Installation
  5. Official website
  6. Tutorial on Arch Linux
  7. Compatibility
  8. Fixing Problems


About driver

It's a manufacturer software of standard serial to usb chip marked CH340



Changes

Added line
#include <linux/sched/signal.h>

which helps to fix the problem below:
error: implicit declaration of function ‘signal_pending’; did you mean ‘timer_pending’? [-Werror=implicit-function-declaration]

and changed line:
wait_queue_t wait;
to
wait_queue_entry_t wait;
which helps to fix next problem below:
error: unknown type name ‘wait_queue_t’; did you mean ‘wait_event’?


added version check of kernel for signal.h:
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0)
#include <linux/signal.h>
#else
#include <linux/sched/signal.h>
#endif

Thanks to hesaputra - #10

Additionally first pull request helped to merge changes for version 1.5 released in 2018-03-18: [https://github.com/juliagoda/CH341SER/pull/1](https://github.com/juliagoda/CH341SER/pull/1)

Tests

Tested on:

  • Arch Linux 4.11.3-1-hardened
  • Arch Linux 4.11.3-1-ARCH
  • Linux Mint 19.3 Cinnamon
  • Ubuntu 18.04.5 LTS
  • CentOS Linux release 8.3.2011


Installation

See original readme.txt



Official website

http://www.wch.cn/download/CH341SER_LINUX_ZIP.html



Tutorial on Arch Linux

Tested for Arduino UNO R3 Clone

install required packages:
sudo pacman -S arduino arduino-docs avr-binutils avr-gcc avr-libc avrdude


if your system detects the package below:
pacman -Qs arduino-avr-core


you should remove it:
sudo pacman -R arduino-avr-core


we add current user to uucp and lock groups:

gpasswd -a $USER uucp
gpasswd -a $USER lock

it's possible, that you have to load that module:
modprobe cdc_acm


clone fixed driver:
git clone https://github.com/juliagoda/CH341SER.git


according to the original readme.txt, we use the commands below:

make
sudo make load

to be sure, that module will be loaded after reboot, you can change file extension from ".ko" to ".ko.gz" and add it to drivers path:

find . -name *.ko | xargs gzip
sudo cp ch34x.ko.gz /usr/lib/modules/$(uname -r)/kernel/drivers/usb/serial

if the command:
lsmod | grep ch341


shows some result (but it doesn't have to), then:

sudo rmmod ch341
sudo mv /usr/lib/modules/$(uname -r)/kernel/drivers/usb/serial/ch341.ko.gz /lib/modules/$(uname -r)/kernel/drivers/usb/serial/ch341.ko.gz~

sudo depmod -a


let's connect Arduino UNO R3 Clone to USB input and check our results:
dmesg | grep ch34x


that's example of my command's output:

[  492.836159] ch34x 3-1:1.0: ch34x converter detected
[  492.846265] usb 3-1: ch34x converter now attached to ttyUSB0

so our driver ch34x was successfully loaded and our port's name is ttyUSB0

Let's start our installed Arduino IDE.

First we should install package for Arduino AVR Boards from Boards Manager:


Choose of Boards Manager


Installation of packages for Arduino AVR Boards from Boards Manager


And now we must choose our port's name. My port's name is ttyUSB0.


Choose of port's name




Why we wanted arduino-avr-core package from official repo to be removed? Let's check it out.

sudo pacman -S arduino-avr-core


and let's reopen our Arduino IDE and check out boards list.


New label have been added to boards list


New label "Arch Linux Arduino AVR Boards" with boards has been added to boards list. It has the same options, so let's choose "Arduino/Genuino Uno" from a new part and upload our code to Arduino UNO R3 Clone.


The same option has been checked in new part


Upload with error


It didn't work. I think, that the package was created for original arduino boards, which are not compatible with their clones. If you want to have installed the package and work on clone of Arduino, better choose the same option from part labeled "Arduino AVR Boards".



Compatibility

This driver is not compatible with the Olimex ESP32-POE rev C board

Fixing Problems

if the dmesg command does not indicate ttyUSB, only:

[ 457.050482] usbserial: USB Serial support registered for ch34x
1279.608531] ch34x 3-2:1.0: ch34x converter detected

then:

  1. some dependencies are missing (are not installed)
  2. at this stage the Arduino was connected not only to USB, but also to a prepared breadboard (you have to unplug cables connecting Arduino to breadboard)
  3. kernel hearders are missing (are not installed)
  4. It may happen, that kernel doesn't contain CONFIG_USB_SERIAL_CH341 flag, but you need it or it is disabled. You have to check configs of the kernel you are using