28

Here's the deal, I want to flash my stm32 board with my USB serial port. And my stm32 board comes with an extended board which carries CH340.

When I connected the board to my computer, I can see the device with the command lsusb, and the output is Bus 001 Device 039: ID 1a86:7523 QinHeng Electronics CH340 serial converter.

But I can't find the ttyUSB file under /dev path.

And then I ran dmesg | grep tty, here is the output:

[1182096.667353] usb 1-9: ch341-uart converter now attached to ttyUSB0
[1182096.729868] audit: type=1130 audit(1637925474.011:3648): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=brltty-device@sys-devices-pci0000:00-0000:00:14.0-usb1-1\x2d9 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[1182096.800144] audit: type=1130 audit(1637925474.081:3649): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=brltty@-sys-devices-pci0000:00-0000:00:14.0-usb1-1\x2d9 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[1182096.803145] usb 1-9: usbfs: interface 0 claimed by ch341 while 'brltty' sets config #1
[1182096.803731] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0

Does anyone know what's the problem here? Thanks.

LunarEclipse
  • 661
  • 1
  • 4
  • 14
  • Possible duplicate [Unable to use USB dongle based on USB-serial converter chip](https://unix.stackexchange.com/questions/670636/unable-to-use-usb-dongle-based-on-usb-serial-converter-chip) – Flexz Nov 26 '21 at 11:44

4 Answers4

68

For Ubuntu 22.04 the simplest solution is to remove the package brltty via sudo apt remove brltty, since its unnecessary unless you're using a braille e-reader, however unsure if it could cause errors later on.

Also for information about brltty visit there site at https://brltty.app/

intlsy
  • 821
  • 4
  • 7
  • 5
    perfect did work for me with Ubuntu 22.04. Thanks a lot – David Stäheli Dec 10 '22 at 13:01
  • 2
    How awful to ship a distro with built-in software that's hard coded exclusively to claim ttyUSB0 and disconnect when hardware is not known by the software – izzulmakin Dec 27 '22 at 12:27
  • 1
    the question is: why was this installed in 22.04? – A. Herlas Feb 25 '23 at 10:30
  • My friend have similar problem, but log is slightly different: 'sudo dmesg | grep ttyUSB [ 27.433315] ch341-uart ttyUSB0: break control not supported, using simulated break [ 27.433369] usb 1-8: ch341-uart converter now attached to ttyUSB0 [ 28.079264] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0...' Your answer - helped, thank you very much! – Иван Игонькин Jun 26 '23 at 09:59
  • it works for me and it should be an accepted answer – muchtarsp Aug 20 '23 at 03:43
8

Well, I just found a post in forum.manjaro.org, here's the link: https://forum.manjaro.org/t/cant-connect-serial-port-error-ch341-uart-disconnected-from-ttyusb0/87208

It seems for arch/manjaro system(not sure if suitable for other distros), you need to remove some udev rules.

sudo mv /usr/lib/udev/rules.d/90-brltty-device.rules /usr/lib/udev/rules.d/90-brltty-device.rules.disabled
sudo mv /usr/lib/udev/rules.d/90-brltty-uinput.rules /usr/lib/udev/rules.d/90-brltty-uinput.rules.disabled
sudo udevadm control --reload-rules

I don't know why, but I did it. And it worked. Now I can find my ttyUSB0 device file.

LunarEclipse
  • 661
  • 1
  • 4
  • 14
5

So, there is a braille ereader that uses this same serial converter, and the udev rules configure the chip for that device. You actually don't need to remove the udev rules files completely, you can simply disable/comment out the rule for the single device. It is this one:

# Device: 1A86:7523
# Baum [NLS eReader Zoomax (20 cells)]
ENV{PRODUCT}=="1a86/7523/*", ENV{BRLTTY_BRAILLE_DRIVER}="bm", GOTO="brltty_usb_run"

Comment the line starting with ENV.

4

I was able to see the device using lsusb and dmesg|grep tty but was not able to upload code from platformio.

sudo apt remove brltty

this fixed my upload issue with ESP8266 (ch341-uart converter) on Ubuntu 20.04.