CH347 USB Bridge: I2C EEPROM, SPI and GPIO
The WCH CH347 is a USB bridge chip that gives a PC an I2C bus, a SPI bus and a few GPIO pins. In CycBox a single
CH347 connection (ch347_transport) opens the device once and serves all three:
requests from message inputs or Lua run one after another on the device, and their results come back as messages in the
message list and in on_receive().
This guide sets up a CH347 on Linux or Windows and walks through a common first task: reading, programming and verifying a 24C02 I2C EEPROM.
The CH347 transport runs on Linux and Windows desktop builds and is a Premium feature.
Prerequisites
Chip mode
A CH347T selects its USB function set with its mode pins. Use a mode that includes I2C and SPI: mode 1 (UART + SPI +
I2C + JTAG, USB ID 1a86:55db) or mode 2 (UART + SPI + I2C + GPIO, 1a86:55dd). A CH347F (1a86:55de) provides
all of them. Most CH347 modules have a jumper or switch for this.
Linux: driver and permissions
CycBox talks to the CH347 through WCH's ch34x_pis kernel module, which ships in WCH's CH341PAR_LINUX driver
package. Once the module is loaded, the device shows up as /dev/ch34x_pis0 (one node per device).
CycBox works with the V1.5 (2024.12) ch34x_pis driver. V1.7 (2026.11) changed the driver interface and is not
supported yet: CycBox refuses to open the device and reports Unsupported CH347 driver. Check the loaded version with
sudo dmesg | grep ch34x_pis.
Build and load the module from the package's driver folder:
cd CH341PAR_LINUX/driver
make
sudo rmmod ch34x_pis 2>/dev/null # unload another version first
sudo insmod ./ch34x_pis.ko
insmod lasts until the next reboot; sudo make install in the same folder installs the module permanently.
Those nodes are owned by root, so CycBox fails to open the device as a normal user. Add a udev rule, for example
/etc/udev/rules.d/99-ch34x.rules:
# Char device nodes created by the ch34x_pis kernel module (CH347 + CH341)
KERNEL=="ch34x_pis*", MODE="0666"
Reload the rules and replug the device:
sudo udevadm control --reload-rules
sudo udevadm trigger
ls -l /dev/ch34x_pis* # should show crw-rw-rw-
Windows: driver
Install WCH's CH347 driver (CH341PAR/CH347PAR). It also installs the CH347DLL runtime library CycBox loads. Devices
are opened by index (0 for the first one).
Wiring a 24C02
| 24C02 pin | Connect to |
|---|---|
| SDA, SCL | CH347 SDA, SCL |
| VCC, GND | 3.3 V and GND of the CH347 module |
| A0, A1, A2 | GND (device address 0x50) |
| WP | GND — writes are ignored while WP is high |
I2C needs pull-up resistors on SDA and SCL. Many CH347 modules and EEPROM breakout boards already have them; add 4.7 kΩ to 3.3 V if neither does.
Set up the connection
The quickest start is the example configuration, which sets up the connection, the Lua script and the message inputs in
one go: download ch347_i2c_eeprom.lua and
load it on the Settings page with Load.
To set it up by hand instead, choose CH347 as the transport in Basic Configuration and fill in the CH347 section:
- CH347 Device: the detected devices are listed (
/dev/ch34x_pis0on Linux, an index on Windows). An empty list on Linux means the kernel module is not loaded. - I2C Speed: 100 kHz (standard) is safe for any 24-series chip; most also run at 400 kHz.
- SPI Mode / SPI Speed: only used by SPI requests; leave the defaults for I2C work.

The example's connection, with defaults left out:
[
{
"app": {
"app_transport": "ch347_transport",
"app_codec": "timeout_codec"
},
"ch347_transport": {
"ch347_transport_i2c_speed": "1"
}
}
]
Scan the bus
Press Start, then send the Scan I2C bus input from the message page. The example script logs every address that
answered, for example I2C scan: devices at 0x50. If nothing answers, check the wiring, power and pull-ups before
going further.
Read and program the EEPROM
An EEPROM message input reads or programs a region of a 24-series chip. Pick the chip from Chip (24C01 to
24C1024); it fills in the address width and page size. Use Custom for other chips and for 24C04/08/16, which fold the
high address bits into the device address (treat each 256-byte block as its own chip at 0x50, 0x51, …).
- Read takes a start Address and a Length. The data arrives as RX messages of up to Chunk bytes each (under Advanced, with the device address, address width, page size and write delay).
- Program writes the hex (or text) payload from the start address, split at page boundaries. An EEPROM needs no erase. With Verify after write on, the region is read back afterwards, so the message list shows what actually landed on the chip.
The example adds four inputs: scan, program a 16-byte test pattern into 0xF0–0xFF with verify, read that region
back, and dump the whole chip.

Programming overwrites the chip. The example only writes the last 16 bytes of a 24C02; check the start address before programming a chip whose contents you need.
Automate it with Lua
The EEPROM Lua helpers do the same from a script: eeprom_new{...} returns a chip handle, and
:program(), :read() and :verify() queue requests whose results arrive in on_receive(). On start, the example
scans the bus, programs and verifies the test pattern, and reads it back, logging each result:
-- CH347 I2C EEPROM: scan, program, verify and read back a 24C02
--
-- Hardware: a CH347 USB bridge (I2C on SDA/SCL) wired to a 24C02 EEPROM with
-- A2/A1/A0 grounded, so the chip answers at 0x50. The script works with any
-- 24-series chip once EEPROM_GEOMETRY below matches it (see the EEPROM Lua API
-- docs for other chips).
--
-- On start the script:
-- 1. scans the I2C bus and logs every device that answers,
-- 2. programs a 16-byte test pattern into the LAST 16 bytes of the chip
-- (0xF0-0xFF) and verifies it by reading it back,
-- 3. reads the test region again and logs it as hex.
-- Only the test region is overwritten; the rest of the chip is left as it was.
--
-- The message inputs repeat each step by hand (scan, program, read the test
-- region, dump the whole chip).
local EEPROM_GEOMETRY = { dev = 0x50, addr_bytes = 1, page = 8, chunk = 16 }
local TEST_ADDR = 0xF0
local TEST_LEN = 16
local chip
-- Bytes 0x00, 0x11, ..., 0xFF
local function test_pattern()
local bytes = {}
for i = 0, TEST_LEN - 1 do
bytes[#bytes + 1] = i * 0x11
end
return bytes
end
local function to_hex(data)
local hex = {}
for i = 1, #data do
hex[#hex + 1] = string.format("%02X", string.byte(data, i))
end
return table.concat(hex, " ")
end
function on_start()
-- Helpers are registered after the script body runs, so create the chip here.
chip = eeprom_new(EEPROM_GEOMETRY)
i2c_scan(0x03, 0x77, 0)
-- Requests on one connection run in order: the read sees the new data.
chip:program(TEST_ADDR, test_pattern())
chip:read(TEST_ADDR, TEST_LEN)
end
-- Log the addresses that ACKed in an i2c_scan result.
local function log_scan()
local found = {}
for addr = 1, #message.payload - 1 do
if read_u8(message.payload, addr + 1) ~= 0 then
found[#found + 1] = string.format("0x%02X", addr)
end
end
if #found == 0 then
log("warn", "I2C scan: no device answered, check wiring and pull-ups")
else
log("info", "I2C scan: devices at " .. table.concat(found, ", "))
end
end
-- Log the final result of an EEPROM read / program / verify.
local function log_eeprom_complete()
local phase = message:get_metadata("eeprom_phase")
local result = message:get_value("result")
if result == "mismatch" then
log("error", string.format("EEPROM %s: mismatch at 0x%02X", phase, message:get_value("mismatch_at")))
else
log("info", string.format("EEPROM %s: %s", phase, result))
end
end
function on_receive()
if message:get_metadata("i2c_op") == "scan_response" then
log_scan()
return false
end
local op = message:get_metadata("eeprom_op")
if op == "read_chunk" then
local addr = message:get_metadata("eeprom_addr")
log("info", string.format("EEPROM 0x%02X: %s", addr, to_hex(message.payload)))
message.display_hex = true
return true
elseif op == "complete" then
log_eeprom_complete()
elseif op == "error" then
log("error", "EEPROM " .. tostring(message:get_value("error")))
end
return false
end
Full example: cycbox/examples/ch347_i2c_eeprom.lua

Things to note:
- Create the chip handle in
on_start(): helper functions such aseeprom_newdo not exist yet while the top level of the script runs. - Progress, completion and error results are events. They reach
on_receive()but are not shown in the message list, so the script logs them. resultisok,mismatch(with the first bad address inmismatch_at) orcancelled.
For other I2C devices (sensors, port expanders), use the generic I2C helpers or the I2C message input (scan, read, write with an optional register byte).
SPI and GPIO
The same connection also drives the SPI bus and the GPIO pins:
- SPI: the SPI message input (write, read, full-duplex transfer) and the SPI Lua helpers. The bus mode and clock come from the connection settings.
- GPIO: Lua only, through the GPIO helpers.
Troubleshooting
| Symptom | Check |
|---|---|
| CH347 Device list is empty (Linux) | ch34x_pis kernel module loaded (lsmod | grep ch34x); chip in a mode with I2C/SPI |
| Connection fails to open (Linux) | udev rule installed and device replugged; ls -l /dev/ch34x_pis* shows crw-rw-rw- |
Unsupported CH347 driver (Linux) | A V1.7 or newer ch34x_pis is loaded: unload it and load the V1.5 module |
| Scan finds no device | SDA/SCL swapped, missing pull-ups, EEPROM not powered |
Program ends with mismatch | WP pin high; wrong chip preset (address width or page size); wrong device address |
| Data repeats every 256 bytes on a big chip | 1-byte address width used on a 24C32 or larger chip — pick the right preset |