Skip to content

fix(rp2040): make PIO loopback capture deterministic - #3675

Merged
zackees merged 1 commit into
masterfrom
feat/rp2040-phase8-soak
Jul 15, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/rp2040-phase8-soak

Conversation

@zackees

@zackees zackees commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Make RP2040 PIO RX capture deterministic for short WS2812 frames and surface setup/overflow diagnostics.
  • Serialize PIO program, state-machine, DMA, and capture-buffer ownership across the Phase 5 TX/RX paths.
  • Add AutoResearch selectors for PIO0, PIO1, and concurrent PIO0+PIO1 resource checks.

Validation

  • uv run pytest ci/tests/test_autoresearch_phases.py --tb=short (98 passed)
  • bash test rx --debug
  • RP Pico HIL via fbuild / AutoResearch, GPIO11 -> GPIO8:
    • PIO0 exact-byte WS2812B, 1/25/100 LEDs, four patterns: pass
    • PIO1 exact-byte WS2812B, 1/25/100 LEDs, four patterns: pass
    • PIO0+PIO1 concurrent show/wait resource test: pass

Refs #3658
Refs #3648

Summary by CodeRabbit

  • New Features
    • Added support for selecting RP2040/RP2350 PIO0, PIO1, or both PIO engines for Flex IO transmissions.
    • Added detailed diagnostics for PIO activity, transmission failures, RX initialization errors, and signal transitions.
  • Improvements
    • Improved RP PIO resource management and concurrent transmission handling.
    • Enhanced RX capture reliability and memory usage on supported boards.
    • Added clearer validation and troubleshooting information for parallel tests.
  • Bug Fixes
    • Corrected success reporting and cleanup behavior for parallel PIO tests.

@zackees
zackees merged commit 779998c into master Jul 15, 2026
8 of 11 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jul 15, 2026
@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: 3089534d-3a63-4d82-9622-b40b6d5a62aa

📥 Commits

Reviewing files that changed from the base of the PR and between 5d4e0af and bb34788.

📒 Files selected for processing (20)
  • ci/autoresearch/args.py
  • ci/autoresearch/context.py
  • ci/autoresearch/phases.py
  • ci/tests/test_autoresearch_phases.py
  • examples/AutoResearch/AutoResearch.ino
  • examples/AutoResearch/AutoResearchRemoteRunParallelTest.cpp
  • examples/AutoResearch/AutoResearchRemoteRunSingleTest.cpp
  • examples/AutoResearch/AutoResearchTest.cpp
  • examples/AutoResearch/AutoResearchTest.h
  • src/fl/channels/rx.h
  • src/fl/channels/rx/channel.cpp.hpp
  • src/fl/channels/rx/channel.h
  • 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_dma_resource_manager.h
  • src/platforms/arm/rp/rpcommon/rp_pio_edge_capture.h
  • src/platforms/arm/rp/rpcommon/rp_pio_tx_peripheral.cpp.hpp
  • src/platforms/arm/rp/rpcommon/rx_pio_channel.cpp.hpp
  • src/platforms/arm/rp/rpcommon/rx_pio_channel.h
  • tests/platforms/arm/rp/rpcommon/channel_engine_rp_pio.cpp

📝 Walkthrough

Walkthrough

Changes

RP2040/RP2350 autoresearch now supports selecting one or both PIO engines. RP PIO TX resource handling, RX sampling, DMA capture, diagnostics, and parallel-test validation were expanded with associated API and test updates.

RP PIO autoresearch and validation

Layer / File(s) Summary
PIO selection and response validation
ci/autoresearch/..., ci/tests/test_autoresearch_phases.py
Adds PIO selection flags, driver mapping, concurrent-resource response validation, diagnostics output, and unit coverage.
PIO resource ownership and TX diagnostics
src/platforms/arm/rp/rpcommon/rp_pio_dma_resource_manager.h, src/platforms/arm/rp/rpcommon/channel_engine_rp_pio.*, src/platforms/arm/rp/rpcommon/rp_pio_tx_peripheral.cpp.hpp, tests/platforms/arm/rp/rpcommon/channel_engine_rp_pio.cpp
Centralizes PIO program and capture-buffer ownership and exposes TX start, error, word-count, and active-state diagnostics.
Shared RP PIO RX sampling and decoding
src/platforms/arm/rp/rpcommon/rx_pio_channel.*, src/platforms/arm/rp/rpcommon/rp_pio_edge_capture.h
Replaces duration capture with shared-buffer phase sampling, updated DMA setup, fixed edge storage, cleanup, and decoding.
Capture diagnostics and response serialization
src/fl/channels/rx.*, examples/AutoResearch/AutoResearchTest.*, examples/AutoResearch/AutoResearchRemoteRunSingleTest.cpp
Propagates RX begin errors, GPIO transition counts, expected frame sizes, and RP PIO runtime state through test responses.
Parallel PIO execution reporting
examples/AutoResearch/AutoResearchRemoteRunParallelTest.cpp, examples/AutoResearch/AutoResearch.ino
Maps PIO0/PIO1 explicitly, reports wait and concurrency status, skips incompatible RX loopback capture, and adjusts RP buffer sizing.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related issues

  • FastLED/FastLED issue 3647 — Covers the RP PIO TX/RX capture, resource management, diagnostics, and tests changed here.
  • FastLED/FastLED issue 3656 — Covers RP PIO RX DMA capture and resource management.
  • FastLED/FastLED issue 3658 — Covers RP PIO TX selection, diagnostics, and concurrency testing.
  • FastLED/FastLED issue 3655 — Covers RP PIO edge capture and decoding.
  • FastLED/FastLED issue 3654 — Covers the RP PIO RX backend lifecycle and diagnostics.

Possibly related PRs

✨ 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-phase8-soak

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