comm-bus

comm-bus is a command for coding agents from HermeticOrmus/LibreEmbed-Claude-Code. It costs 0 tokens per session (2,724 once invoked), scanned A, original, MIT.

A coding-agent command for designing, debugging, or moving communication-bus drivers. Communication buses are hardware links such as I2C, SPI, UART, CAN, and USB; an MCU is the small processor inside an embedded device.

In plain words
What is it for?
Use it to plan driver initialization, choose between direct, interrupt, or DMA transfers, handle errors, configure MCU peripherals, or investigate a faulty bus driver.
Why use it?
It helps structure the problem before driver work begins and avoids guessing about the bus, processor, connected device, transfer needs, or reliability constraints.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/hermeticormus/libreembed-claude-code/comm-bus
Clone the repo
git clone --depth 1 https://github.com/HermeticOrmus/LibreEmbed-Claude-Code
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,724 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02724
Opus 5 $0.00000 $0.01362
Sonnet 5 $0.00000 $0.00545
Haiku 4.5 $0.00000 $0.00272

Measured 3d ago against content hash 277c9de3db39, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

comm-bus scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/communication-buses/commands/comm-bus.md · 233 lines

How it starts

The opening of the file, as written. The whole thing — 233 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Communication bus driver design and debug

You are a bus-driver-engineer agent using deep expertise across I2C, SPI, UART, CAN, and USB. Help the user design a correct driver, debug a misbehaving driver, or migrate a driver between MCU families.

Context

The user is writing or debugging a communication bus driver. They need: driver structure design, DMA strategy choice, error-handling pattern, MCU-specific peripheral configuration, or root-cause analysis for a misbehaving bus.

Requirements

$ARGUMENTS

Instructions

1. Clarify before designing

If any of these are missing, ask:

  • Which bus: I2C, SPI, UART, CAN, USB, or other?
  • Target MCU + HAL: STM32F4 + STM32 HAL? ESP32 + ESP-IDF? nRF52 + nRFx? RP2040 + pico-sdk?
  • Transfer characteristics: throughput required, packet size, frequency
  • Slave / peer details: chip name, datasheet hints (mode for SPI, address for I2C, etc.)
  • Constraints: low power (sleep between transfers?), real-time (microsecond latency target?), high reliability (ECC, retries)?

Do not fabricate any of these.

2. Design the init sequence

The init order matters. Wrong order = peripheral doesn't work. Right order is:

  1. Clock enable for the peripheral (RCC for STM32, CLOCK module for ESP32, etc.)
  2. Clock enable for the GPIO port the bus uses
  3. GPIO configuration — mode (alternate function), speed, pull-up/pull-down, alternate function number
  4. Peripheral configuration — speed, mode, frame size, FIFO threshold
  5. DMA configuration if using DMA — channel/stream selection, direction, increment mode, mode (normal/circular), priority
  6. Interrupt configuration — enable peripheral interrupts (TXIE, RXIE, ERR, etc.)
  7. NVIC — enable + set priority (must be below the RTOS-safe threshold, usually configMAX_SYSCALL_INTERRUPT_PRIORITY)
  8. Enable the peripheral as the last step

Example (STM32F4 SPI master, mode 0, DMA RX + TX):

spi_status_t spi_init(SPI_HandleTypeDef *hspi) {
    // 1. Clock enable
    __HAL_RCC_SPI1_CLK_ENABLE();
    __HAL_RCC_GPIOA_CLK_ENABLE();
    __HAL_RCC_DMA2_CLK_ENABLE();

    // 2. GPIO config: PA5=SCK, PA6=MISO, PA7=MOSI, AF5 for SPI1
    GPIO_InitTypeDef g = {0};
    g.Pin = GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7;
    g.Mode = GPIO_MODE_AF_PP;
    g.Pull = GPIO_NOPULL;
    g.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
    g.Alternate = GPIO_AF5_SPI1;
    HAL_GPIO_Init(GPIOA, &g);

    // 3. SPI peripheral config
    hspi->Instance = SPI1;
    hspi->Init.Mode = SPI_MODE_MASTER;
    hspi->Init.Direction = SPI_DIRECTION_2LINES;
    hspi->Init.DataSize = SPI_DATASIZE_8BIT;
    hspi->Init.CLKPolarity = SPI_POLARITY_LOW;     // CPOL = 0
    hspi->Init.CLKPhase = SPI_PHASE_1EDGE;          // CPHA = 0
    hspi->Init.NSS = SPI_NSS_SOFT;                  // GPIO CS
    hspi->Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;  // 84 MHz / 8 = 10.5 MHz
    hspi->Init.FirstBit = SPI_FIRSTBIT_MSB;
    hspi->Init.TIMode = SPI_TIMODE_DISABLE;
    hspi->Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
    HAL_SPI_Init(hspi);

    // 4. DMA config
    static DMA_HandleTypeDef hdma_tx, hdma_rx;
    hdma_tx.Instance = DMA2_Stream3;     // SPI1 TX uses stream 3 or 5
    hdma_tx.Init.Channel = DMA_CHANNEL_3;
    hdma_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
    hdma_tx.Init.MemInc = DMA_MINC_ENABLE;
    hdma_tx.Init.PeriphInc = DMA_PINC_DISABLE;
    hdma_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
    hdma_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
    hdma_tx.Init.Mode = DMA_NORMAL;
    hdma_tx.Init.Priority = DMA_PRIORITY_HIGH;
    HAL_DMA_Init(&hdma_tx);
    __HAL_LINKDMA(hspi, hdmatx, hdma_tx);

    // (Similar for RX on stream 0 or 2)

    // 5. NVIC
    HAL_NVIC_SetPriority(DMA2_Stream3_IRQn, 5, 0);  // Below RTOS-safe threshold
    HAL_NVIC_EnableIRQ(DMA2_Stream3_IRQn);
    HAL_NVIC_SetPriority(SPI1_IRQn, 5, 0);
    HAL_NVIC_EnableIRQ(SPI1_IRQn);

    return SPI_OK;
}

Read the full file on GitHub · 233 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 233 lines · 0 tokens per session scan A 277c9de3db39

Subscribe to this mod's changes

comm-bus is a command published in the GitHub repository HermeticOrmus/LibreEmbed-Claude-Code (44 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,724 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.