Skip to content

feat(rp2040): batch compatible PIO TX lanes - #3667

Merged
zackees merged 1 commit into
masterfrom
feat/rp2040-phase5-pio-batching
Jul 15, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/rp2040-phase5-pio-batching

Conversation

@zackees

@zackees zackees commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

Part of #3658.

Adds conservative 2/4/8 lane PIO TX batching on the single-lane foundation in #3666. A batch is admitted only for adjacent channels that have identical ChipsetTimingConfig values, equal byte sizes, and consecutive GPIO pins. All incompatible work remains serialized.

The PIO program changes its OUT/autopull width to the lane count; the encoder emits exact bit planes and host tests cover 1, 2, 4, and 8 lane packing plus error/latch lifecycle.

Validation: bash test channel_engine_rp_pio --debug; bash test channel_engine_rp_pio --cpp; unified C++ lint with --no-rust.

Summary by CodeRabbit

  • New Features

    • Added support for multi-lane RP PIO transmissions using 2, 4, or 8 adjacent compatible channels.
    • Improved DMA payload packing for parallel lane output.
    • Added support for claiming and releasing contiguous pin ranges.
  • Bug Fixes

    • Improved resource cleanup when PIO, DMA, or pin allocation fails.
    • Enhanced transmission progress tracking for batched channels.
  • Tests

    • Added coverage for 2-, 4-, and 8-lane batching, payload placement, lifecycle handling, and cleanup.

@zackees
zackees merged commit ec99646 into master Jul 15, 2026
6 of 9 checks passed
@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 31d9064a-dd8c-4867-8002-787fd55bb08c

📥 Commits

Reviewing files that changed from the base of the PR and between 2001c8b and 8970295.

📒 Files selected for processing (7)
  • src/platforms/arm/rp/rpcommon/channel_engine_rp_pio.cpp.hpp
  • src/platforms/arm/rp/rpcommon/channel_engine_rp_pio.h
  • src/platforms/arm/rp/rpcommon/irp_pio_tx_peripheral.h
  • src/platforms/arm/rp/rpcommon/rp_pio_dma_resource_manager.h
  • src/platforms/arm/rp/rpcommon/rp_pio_tx_peripheral.cpp.hpp
  • src/platforms/arm/rp/rpcommon/rp_pio_tx_peripheral.h
  • tests/platforms/arm/rp/rpcommon/channel_engine_rp_pio.cpp

📝 Walkthrough

Walkthrough

RP PIO transmission now supports 1-, 2-, 4-, and 8-lane batching. Peripheral setup claims contiguous pins, the channel engine repacks DMA words across lanes, polling advances by batch size, and tests cover payloads, batching, progression, and cleanup.

Changes

RP PIO multi-lane transmission

Layer / File(s) Summary
Lane-aware peripheral and resource ownership
src/platforms/arm/rp/rpcommon/irp_pio_tx_peripheral.h, src/platforms/arm/rp/rpcommon/rp_pio_tx_peripheral.*, src/platforms/arm/rp/rpcommon/rp_pio_dma_resource_manager.h
PIO configuration accepts supported lane counts, configures consecutive output pins, and claims or releases the full pin range transactionally.
Channel batching and DMA word packing
src/platforms/arm/rp/rpcommon/channel_engine_rp_pio.*
The engine batches compatible adjacent channels, constructs per-lane DMA words, tracks the active lane count, and advances queued-channel state by each batch size.
Multi-lane behavior validation
tests/platforms/arm/rp/rpcommon/channel_engine_rp_pio.cpp
Tests validate expanded DMA payloads, compatible-run batching, 4- and 8-lane operation, polling progression, and channel cleanup.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

  • FastLED/FastLED issue 3658 — Covers the same PIO clockless TX batching, multi-lane support, resource allocation, and lifecycle validation.
  • FastLED/FastLED issue 3647 — Covers the RP PIO TX lane batching, DMA packing, and multi-pin resource handling changed here.

Possibly related PRs

  • FastLED/FastLED#3662 — Directly relates to contiguous pin-range claims in RpPioDmaResourceManager.
  • FastLED/FastLED#3666 — Provides the single-lane RP PIO foundation extended here for variable lane counts and batching.

Sequence Diagram(s)

sequenceDiagram
  participant ChannelEngineRpPio
  participant RpPioTxPeripheral
  participant RpPioDmaResourceManager
  ChannelEngineRpPio->>ChannelEngineRpPio: Select compatible adjacent channels
  ChannelEngineRpPio->>RpPioTxPeripheral: Configure lane_count and tx_pin
  RpPioTxPeripheral->>RpPioDmaResourceManager: Claim contiguous pins and DMA resources
  ChannelEngineRpPio->>RpPioTxPeripheral: Send packed DMA words
  ChannelEngineRpPio->>ChannelEngineRpPio: Advance by active lane count
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/rp2040-phase5-pio-batching

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant