Skip to main content

CH347 Transport

A WCH CH347 USB bridge as one connection that serves its I2C bus, SPI bus and GPIO pins. Requests come from the I2C, SPI and EEPROM message inputs or from the I2C, EEPROM, SPI and GPIO Lua helpers, and run one after another on the device.

On Linux it needs WCH's ch34x_pis kernel module and a udev rule for /dev/ch34x_pis*; on Windows, WCH's CH347 driver. See the CH347 guide for setup, wiring and an I2C EEPROM walkthrough.

A CH347 connection at 100 kHz I2C, using the detected device.

Configuration reference​

Config IDch347_transport
Selected byapp_transport = "ch347_transport"
PlatformsLinux, Windows
LicensePremium

Message-based I2C + SPI transport over a single CH347 USB bridge device

CH347 USB bridge. One device provides an I2C bus, a SPI bus and GPIO from a single open.

I2C is triggered by messages tagged with i2c_op metadata, SPI by messages tagged with spi_op, and GPIO by messages tagged with gpio_op (GPIO is driven from Lua scripts only); all run serialized over the one device and return their results as messages that Lua scripts can parse.

On Linux needs the WCH CH347 driver and access to the device node (e.g. /dev/ch34x_pis0); on Windows needs the CH347 driver installed.

SettingKeyTypeDefaultNotes
CH347 Devicech347_transport_deviceText (with presets)detected at runtimeRequired
I2C Speedch347_transport_i2c_speedText choice"2"Required
SPI Modech347_transport_spi_modeText choice"0"Required
SPI Speedch347_transport_spi_clockText choice"1"Required

Setting details​

CH347 Device​

The available values are detected on the machine running CycBox (attached devices, generated ids), so no fixed default or option list is shown here.

I2C Speed​

Allowed values:

ValueLabel
"0"20 kHz (low speed)
"1"100 kHz (standard)
"2"400 kHz (fast)
"3"750 kHz (high speed)

SPI Mode​

Allowed values:

ValueLabel
"0"Mode 0
"1"Mode 1
"2"Mode 2
"3"Mode 3

SPI Speed​

Allowed values:

ValueLabel
"0"60 MHz
"1"30 MHz
"2"15 MHz
"3"7.5 MHz
"4"3.75 MHz
"5"1.875 MHz
"6"937.5 KHz
"7"468.75 KHz

Example config​

Default values as they appear in a saved configuration (for example the JSON block at the end of a cycbox/examples/*.lua file). Settings detected at runtime are omitted.

{
"app": {
"app_transport": "ch347_transport"
},
"ch347_transport": {
"ch347_transport_i2c_speed": "2",
"ch347_transport_spi_mode": "0",
"ch347_transport_spi_clock": "1"
}
}