Skip to content

AutoResearch: PWM+DMA clockless validation harness for LPC845 (paired sibling of #3456) #3468

Closed

Description

@zackees

Scope

Build the device-side and host-side AutoResearch validation harness for the LPC845 SCT+DMA clockless channels-API engine that just landed. This is the natural next step in the LPC controller bring-up: the driver is written (#3460), tested on host (#3464), and had its show()/poll() bodies wired to LpcSctDmaTransmitter (#3466). What is still missing is the harness that will actually exercise it on a real LPC845-BRK — a self-loopback through the LPC SCT-capture RX device.

This is the paired sibling of #3456 — same architectural shape, but for the clockless engine instead of the SPI engine. Same on-device and host-side plumbing pattern; the two harnesses just point at different drivers.

Background

After #3466:

  • ChannelEngineLpcSctDma implements the full IChannelDriver contract with a real show() body backed by the runtime LpcSctDmaTransmitter (SCT match programming + 3-DMA-channel chunk-stream encode + busy-wait for chunk completion).
  • Host tests (tests/fl/channels/lpc_sct_dma_engine.cpp) validate the channels-API contract + a TX→RX byte-flow round-trip using LpcSctRxChannel::injectEdges().
  • The RX device (src/platforms/arm/lpc/rx_sct_capture.cpp.hpp) has a fully-implemented begin() body — both FASTLED_LPC_RX_SCT polling and FASTLED_LPC_RX_SCT_DMA autonomous DMA capture paths — against UM11029 §10/§14/§16/§21.

What we do not have: any code path where a real WS2812 frame emitted by the engine gets captured by the RX device on the same silicon and byte-compared against what was sent. That is what this issue tracks.

Deliverables

Device-side: examples/AutoResearch/AutoResearchPwmDmaClockless.h

New harness header, gated on #if defined(FL_IS_ARM_LPC_845) && defined(FASTLED_LPC_PWM_DMA), conditionally included from AutoResearch.ino (or AutoResearchLowMemory.h if the 64 KB flash budget pushes back). Wires three RPC handlers on top of the existing remote.bind(...) infrastructure:

  • pwmDmaCl.frameOnce(led_count, color_rgb) — allocates a CRGB[led_count] filled with the requested color, drives one frame through the channels-API path (FastLED.addLeds<WS2812, DATA_PIN, GRB> + FastLED.show()), returns {started_us, done_us, cpu_was_busy_during_transfer: bool}.
  • pwmDmaCl.frameBurst(n_frames, fps_target) — drives n_frames back-to-back at the requested rate, reports actual fps + any inter-frame guard-band overruns.
  • pwmDmaCl.captureSelf(led_count, color_rgb) — drives the frame AND captures the wire via the LPC SCT-capture RX device on the same chip (cross-pin loopback: DATA_PIN → SCT input pin). Returns the decoded byte sequence for host-side byte-for-byte comparison.

Implementation reference: examples/AutoResearch/AutoResearchSimd.h for the header layout + remote.bind pattern.

Host-side: ci/autoresearch/phases.py + wrapper

  • Add --pwm-dma-cl flag to the bash autoresearch wrapper, parallel to --dma-spi (from AutoResearch: SPI-DMA validation harness for LPC845 (Phase 1 of #3453 bench bring-up) #3456).
  • Add a corresponding phase entry in ci/autoresearch/phases.py that:
    • Compiles examples/AutoResearch with -DFASTLED_LPC_PWM_DMA (and -DFASTLED_LPC_RX_SCT_DMA for the RX side) added to build_flags.
    • Calls the three RPC handlers in sequence.
    • Pass criteria:
      • frameOnce: done_us - started_us within ±5% of led_count * 24 * total_period_ns / 1000 (WS2812 wire time).
      • frameBurst: measured fps ≥ 95% of theoretical max for the LED count.
      • captureSelf: decoded bytes match the driven color_rgb for every LED; no drift, no missing edges.
  • Document mutual exclusion vs --dma-spi (AutoResearch: SPI-DMA validation harness for LPC845 (Phase 1 of #3453 bench bring-up) #3456). Both consume DMA0 channels — _PWM_DMA_BASECH=0 uses channels 0/1/2, _SPI_DMA_CHANNEL=4 uses channel 4 — they DO NOT collide by default, but the LowMemory flash budget doesn't fit both. Reject --dma-spi --pwm-dma-cl in the wrapper with a clear error.

Loopback wiring

  • Single jumper on LPC845-BRK: from the WS2812 DATA_PIN (e.g. PIO0_10) to an SCT-capture-capable pin (e.g. PIO0_11). Reuses the existing LPC_SCT_CAPTURE plumbing.
  • Document the jumper + example port setup in agents/docs/hardware-autoresearch.md or an LPC-specific doc section.

Acceptance criteria

  • examples/AutoResearch/AutoResearchPwmDmaClockless.h lands with the three RPC bindings.
  • --pwm-dma-cl flag in bash autoresearch lpc845 wraps to the new phase.
  • All three pass criteria above are bench-validated on LPC845-BRK. Closing this issue requires either scope/LA captures of the wire OR clean self-loopback decoded-bytes-match runs (or both).
  • At least one additional TODO(2842) marker in lpc_sct_dma_runtime.cpp.hpp is closed as a result of the bench validation. Suggested targets:
    • SYSAHBCLKCTRL0 bit assignments (bit 8 = SCT, bit 29 = DMA) — confirm or correct per UM11029 §4.6.13.
    • EVx_CTRL bit layout (bit 12 = COMBMODE) — confirm per §16.6.21.
    • SCT→DMAREQ0 event routing — confirm per §16.6.18.
    • Busy-wait replacement with WFI + DMA-done IRQ.

Dependencies

Hard-blocked by:

  1. [BLOCKER] LPC845-BRK AutoResearch bring-up echo returns empty RX (suspected HardFault) — blocks #3102 #3300 — LPC845-BRK AutoResearch echo silence. Without RPC round-trip there is no way for the host to call any of the three handlers.
  2. [META] LPC8xx compile + autoresearch + channels API end-to-end restoration — all blockers #3450 B2 — framework-arduino-lpc8xx tarball checksum mismatch. Blocks platform install after fbuild 2.3.15 (B1 already resolved).

Soft-blocked by:

  1. LPC845: clockless+DMA channels-API engine — ChannelEngineLpcSctDma wrapping clockless_arm_lpc_pwm_dma.h #3459 addLeds<> route verification — the acceptance criterion "addLeds<WS2812, PIN, GRB> routes through ChannelEngineLpcSctDma::show() via the channels-API path" needs a routing check. If addLeds<> still lands in the legacy clockless_arm_lpc_pwm_dma.h template, frameOnce will drive the wrong engine and the harness will validate the wrong code path. Might need a -DFASTLED_LPC_USE_CHANNELS_API=1 shim in the harness build_flags to force the channels-API path.

Device-side header and host-side phase code can both land while the hard blockers are open — they just won't gate CI on a passing run until the blockers clear. Same "code lands early, validation gates the close" pattern as #3456.

Out of scope

Relationships

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions