zeirix
February 27, 2024, 10:05am
1
Hello everybody,
can anybody tell me, how to use a CH341 USB-I2C adaptor in dietpi?
I’m using DietPi v9.1.1 on a device model RPi B (armv6l).
I’ve already modprobed the i2c-dev
and ch341
modules before connecting the adaptor to one of the USB ports, but in the /dev
tree only the internal i2c-1
is showing up.
The adaptor itself shows up in the debug messages:
[855727.220757] usb 1-1.3.1: new full-speed USB device number 12 using dwc_otg
[855727.353170] usb 1-1.3.1: New USB device found, idVendor=1a86, idProduct=5512, bcdDevice= 3.04
[855727.353252] usb 1-1.3.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
The adaptor itself is working at another computer with another distro. The USB port at the Pi is OK, too.
Thanks a lot!
WarHawk
February 28, 2024, 3:41am
2
zeirix:
wc_otg
is it plugged into the otg port?
Might be able to build it with this?
There is also this
# CH341A USB to I2C and GPIO Linux kernel driver
The driver can be used with **CH341A** USB to UART/I2C/SPI adapter boards to connect I2C devices to a Linux host.
Additionally, CH341A data pins that are not used for synchronous serial interfaces can be configured as **GPIO** pins. The driver can generate **software interrupts** for all input pins. **One input** pin can be connected with the CH341A interrupt pin to generate **hardware interrupts**.
The I2C interface driver was initially derived from [CH341 I2C driver from Tse Lun Bien](https://github.com/allanbian1017/i2c-ch341-usb.git) and extended by GPIO and interrupt handling capabilities.
## I2C interface limitations
By default, the driver uses the standard I2C bus speed of **100 kbps**. I2C bus speeds of 20 kbps, **400 kbps** and 750 kbps are also available.
Currently only basic I2C read and write functions (**`I2C_FUNC_I2C`**) are supported natively. However, SMBus protocols are emulated (**`I2C_FUNC_SMBUS_EMUL`**) with the exception of SMBus Block Read (`I2C_FUNC_SMBUS_READ_BLOCK_DATA`) and SMBus Block Process Call (`I2C_FUNC_SMBUS_BLOCK_PROC_CALL`).
The CH341A only supports **7 bit addressing**.
Due of the limited CH341A USB endpoint buffer size of 32 byte that is used for I2C data as well as adapter in-band signaling, the driver supports only I2C messages with a **maximum data size of 26 bytes**.
## GPIO limitations
This file has been truncated. show original
zeirix
February 28, 2024, 8:43pm
3
Hi WarHawk,
I’ve made and installed the mentioned driver.
With the ch34x
module loaded, the adaptor now seems to be recognized correctly:
[979592.599750] usbcore: registered new interface driver ch34x
[979592.611057] usbserial: USB Serial support registered for ch34x
It also seems to use usbserial
lsmod
Module Size Used by
ch34x 8850 0
i2c_dev 6915 0
usbserial 30953 1 ch34x
…
But, in the device tree nothing changed, the only i2c device is the internal i2c-1
.
Do I need a udev rule for this?
WarHawk
February 29, 2024, 3:25am
4
zeirix:
ch34x
unsure…but go to the “Linux” section here…see if the commands help
https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all
You might have to add the user to the dialout group then reboot…
does lsusb show the device mapped to a USB port/device?
Other than that…I’m at a loss
system
Closed
January 25, 2025, 6:52pm
6
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.