Skip to content

RaftCommandSerialSysMod

Rob Dobson edited this page May 3, 2026 · 1 revision

CommandSerial SysMod

Built-in SysMod that opens one or more dedicated UARTs (separate from SerialConsole) as binary command channels — typically used to attach peripherals or talk to a host MCU.

Source: RaftSysMods/components/CommandSerial/

What it provides

  • Up to four configurable UART ports (MAX_SERIAL_PORTS = 4).
  • Each port is registered as a Comms Channel using the configured protocol codec.
  • Supports bridges: a host on (e.g.) BLE can be connected to a peripheral on a UART, with messages forwarded transparently.
  • commandserial REST endpoint to manage bridges at runtime.

SysType configuration

{
    "name": "CommandSerial",
    "ports": [
        {
            "enable": 1,
            "name": "Serial1",
            "uartNum": 1,
            "baudRate": 921600,
            "rxPin": 16,
            "txPin": 17,
            "rxPullup": 0,
            "rxBufSize": 1024,
            "txBufSize": 1024,
            "protocol": "RICSerial"
        }
    ]
}
Per-port key Default Meaning
enable 0 Enable this port
name auto Channel name reported to CommsChannelManager
uartNum 1 ESP32 UART number
baudRate 921600 Baud rate
rxPin / txPin -1 GPIO pins; -1 = use UART defaults
rxPullup 0 Enable pullup on rx
rxBufSize / txBufSize 1024 UART driver buffer sizes
protocol "" Codec name (RICSerial, RICFrame, RICJSON)

REST endpoints exposed

commandserial accepts JSON (via CommandFrame) for bridge control:

Form Effect
commandserial?cmd=open&port=<name>&name=<bridgeName>&idleCloseSecs=<n> Open a bridge from the requesting channel to port
commandserial?cmd=close&id=<bridgeID>&force=0|1 Close a bridge

(JSON-frame equivalents using cmdName="commandserial" are also supported.)

Related

Clone this wiki locally