cu-bdshot

Crates.iocu-bdshot
lib.rscu-bdshot
version0.12.0
created_at2025-11-26 16:03:59.490335+00
updated_at2026-01-14 19:33:20.958989+00
descriptionCopper Bridge to Bidirectional DSHOT ESCs.
homepagehttps://github.com/copper-project
repositoryhttps://github.com/copper-project/copper-rs
max_upload_size
id1951644
size104,785
Guillaume Binet (gbin)

documentation

README

cu-bdshot

Copper bridge for bidirectional DSHOT (BDShot) ESCs. It exposes up to four EscCommand transmit channels and matching EscTelemetry receive channels. The default cu_bdshot::RpBdshotBridge drives the RP2350 reference board PIO/DMA stack; custom boards can implement BdshotBoard/BdshotBoardProvider.

Channels

  • esc{0-3}_tx (EscCommand): throttle 0–2047, optional telemetry request bit.
  • esc{0-3}_rx (EscTelemetry): latest DShotTelemetry sample per ESC.

Only the channels declared in the Copper config are driven; others stay idle.

Board setup

  • Select exactly one feature:
    • rp2350 (default): RP2350 PIO driver (RpBdshotBridge).
    • stm32h7: STM32H7 bit-bang driver (Stm32BdshotBridge).
  • Build an Rp2350Board from your PIO0 state machines and pin map (defaults: GPIO6–GPIO9, 15.3 MHz PIO clock) and register it once before Copper boots:
    let board = Rp2350Board::new(resources, system_clock_hz, Rp2350BoardConfig::default())?;
    cu_bdshot::register_rp2350_board(board)?;
    
  • Build a Stm32H7Board from GPIOE pins (PE14/13/11/9) plus a running DWT cycle counter and register it once before Copper boots:
    let resources = Stm32H7BoardResources { m1, m2, m3, m4, dwt, sysclk_hz };
    let board = Stm32H7Board::new(resources)?;
    cu_bdshot::register_stm32h7_board(board)?;
    
  • On startup the bridge sends repeated disarm frames and waits for telemetry; it errors out if ESCs never answer.

Configuration

Optional component-level config keys:

  • rate_hz: Maximum per-channel frame rate. If too early, the bridge skips sending on that cycle.

Channel activation is driven solely by the Copper bridge channel list.

Usage

Declare the bridge and wire tasks to it:

(
  bridges: [
    (
      id: "bdshot",
      type: "cu_bdshot::RpBdshotBridge",
      channels: [
        Tx (id: "esc0_tx"), Tx (id: "esc1_tx"), Tx (id: "esc2_tx"), Tx (id: "esc3_tx"),
        Rx (id: "esc0_rx"), Rx (id: "esc1_rx"), Rx (id: "esc2_rx"), Rx (id: "esc3_rx"),
      ],
    ),
  ],
  cnx: [
    (src: "thr", dst: "bdshot/esc0_tx", msg: "cu_bdshot::EscCommand"),
    (src: "bdshot/esc0_rx", dst: "tele0", msg: "cu_bdshot::EscTelemetry"),
  ],
)

See examples/cu_elrs_bdshot_demo for a full mission wiring CRSF RC input into BDShot ESCs on the RP2350 reference board.

Commit count: 956

cargo fmt