Skip to main content

Linux Peripherals Transport

Uses the I2C, SPI and GPIO buses of the Linux board CycBox runs on, such as a Raspberry Pi, through the kernel's device nodes (/dev/i2c-N, /dev/spidevB.C, /dev/gpiochipN). It works like the CH347 transport without the USB bridge, with the same tools:

It is message-based, so no codec is selected.

Each bus is optional: leave a field empty to skip it, but configure at least one. The lists show the device nodes found on the machine. GPIO lines are numbered by their offset on the chosen chip. On a Raspberry Pi that is the BCM GPIO number, not the header pin number.

On a Raspberry Pi:

  1. Enable I2C and SPI with sudo raspi-config (Interface Options), then reboot.
  2. Make sure your user can open the device nodes. If it is not already in the i2c, spi and gpio groups, run sudo usermod -aG i2c,spi,gpio $USER and log in again. Without access, the connection fails when the engine starts.

Configuration reference​

Config IDlinux_transport
Selected byapp_transport = "linux_transport"
PlatformsLinux
LicenseFree

Message-based I2C + SPI + GPIO over native Linux buses (each optional); drives sensors and LCD panels on boards like the Raspberry Pi

Embedded Linux peripherals. Provides an I2C bus, a SPI bus and GPIO from one connection; each is optional — leave a field blank to skip that bus.

I2C is triggered by messages tagged i2c_op, SPI by spi_op, and GPIO by gpio_op (GPIO is driven from Lua scripts only). With SPI and GPIO configured the transport can drive an LCD panel just like a CH347. GPIO line numbers are line offsets on the chosen gpiochip (the BCM numbers on a Raspberry Pi).

Needs read/write access to the relevant device nodes (/dev/i2c-*, /dev/spidev*, /dev/gpiochip*). Linux only.

SettingKeyTypeDefaultNotes
I2C Buslinux_transport_i2c_busText (with presets)detected at runtime
GPIO Chiplinux_transport_gpio_chipText (with presets)detected at runtime
SPI Devicelinux_transport_spi_deviceText (with presets)detected at runtime
SPI Modelinux_transport_spi_modeText choice"0"
SPI Speedlinux_transport_spi_speedText"1000000"

Setting details​

I2C Bus​

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

GPIO Chip​

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

SPI 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.

SPI Mode​

Allowed values:

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

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": "linux_transport"
},
"linux_transport": {
"linux_transport_spi_mode": "0",
"linux_transport_spi_speed": "1000000"
}
}