Skip to content

fix(rp): transmit independent strips concurrently on the PIO engine (#4620) - #4633

Merged
zackees merged 1 commit into
masterfrom
fix/4620-rp-pio-concurrent-strips
Sep 25, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/4620-rp-pio-concurrent-strips

Conversation

@zackees

@zackees zackees commented Sep 25, 2026

Copy link
Copy Markdown
Member

Closes #4620. Part of #4601 / #4580.

What changed

  • ChannelEngineRpPio splits each frame into jobs. As before, consecutive pins with equal timing, XTRA0 and length become one multi-lane batch. Every other strip is its own job.
  • Clockless jobs run concurrently, each on its own IRpPioTxPeripheral (one SM plus one DMA channel). This restores the per-strip parallel output that the old direct controller had.
  • The multi-lane path is unchanged. Each batch still hands every lane pin to the PIO (pio_gpio_init per lane, fix(rp): hand every lane pin to the PIO in multi-lane batches #4628).
  • Resource exhaustion: a queued job that cannot start while other jobs are on the wire waits, then retries when one finishes (no retry on every poll). The same applies to PIO SPI jobs, whose SM can be taken by TX slots. A job that fails with nothing running still fails the frame. Permanent rejections (canHandle, empty data) fail at once.
  • Without a factory (host tests, custom setups), behaviour is the previous sequential engine.

Verification

  • New host tests:
    • two strips on different pins with different lengths start on two peripherals at once, and the frame stays in flight until the longer one latches;
    • when extra resources are exhausted, the second strip queues, makes no configure retries while waiting, and reuses the primary slot.
  • Existing RP PIO tests pass unchanged, including batching, the error paths and PIO SPI.
  • bash test --cpp: 314/314 unit and 95/95 examples. bash test channel_engine_rp_pio --debug is clean. bash lint is clean.
  • bash compile rp2040|rp2350 --examples Blink,BlinkParallel,RGBWW passes.

Code review (/code-review medium)

  • HIGH: an SPI job that could not start failed the frame even while TX slots were about to free resources. Fixed: it now waits and retries.
  • MEDIUM: extra slots could take SMs on every PIO block and starve the PIO1 engine. Fixed: extra slots stay on the engine's own block, capped at 4.
  • LOW: permanent failures waited behind running jobs. Fixed: they are checked before any resource is claimed. Timing that createProgram cannot encode is still treated as possibly transient while other jobs run.

Hardware

Hardware validation is deferred (maintainer decision), tracked in #4623.

🤖 Generated with Claude Code

…4620)

ChannelEngineRpPio now splits a frame into jobs (consecutive-pin batches as
before, everything else on its own) and runs clockless jobs concurrently,
each on its own TX peripheral (state machine + DMA). The bus holder supplies
extra peripherals on the engine's own PIO block, at most four per engine.
When PIO/DMA resources run out, queued jobs wait for a running one to finish
and reuse its resources; permanent rejections still fail the frame at once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zackees
zackees merged commit 1b8e7be into master Sep 25, 2026
60 of 61 checks passed
@zackees
zackees deleted the fix/4620-rp-pio-concurrent-strips branch September 25, 2026 06:06
@coderabbitai

coderabbitai Bot commented Sep 25, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository: FastLED/FastLED/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: b4daba94-286d-478c-9808-494f8a48de6d

📥 Commits

Reviewing files that changed from the base of the PR and between 9892092 and 35670a1.

📒 Files selected for processing (6)
  • 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/rp_pio_tx_bus_traits.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
 ________________________
< Tree-sitter is my GPS. >
 ------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

RP PIO engine: drive non-consecutive / different-length strips concurrently

1 participant