Skip to content

Teensy LED driver bring-up: ObjectFLED + FlexPWM RX + AutoResearch hardening - #3405

Merged
zackees merged 43 commits into
masterfrom
teensy-fix
Jun 26, 2026
Merged

zackees merged 43 commits into
masterfrom
teensy-fix

Conversation

@zackees

@zackees zackees commented Jun 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Consolidates 48 commits of Teensy LED driver bring-up work into master. Squash-merge intended — the individual PRs (#3351–#3404) tell the diagnostic story but the consolidated change is one logical unit: getting ObjectFLED + FlexPWM RX + AutoResearch to where the canonical TX 22 → RX 8 loopback decodes 300/300 bytes per pattern at 99.3% bit accuracy.

What changed

ObjectFLED driver (src/third_party/object_fled/)

FlexPWM input-capture RX driver (src/platforms/arm/teensy/teensy4_common/rx_flexpwm_channel.cpp.hpp)

AutoResearch harness (ci/autoresearch/, examples/AutoResearch/)

Diagnostics (read-only)

Test coverage

Hardware result (canonical TX 22 → RX 8 loopback)

bash autoresearch teensy41 --object-fled --tx-pin 22 --rx-pin 8 --timeout 60 --skip-lint

TEST OBJECT_FLED lanes=1 leds=100 FAIL 32 ms class=decode_mismatch
Captured bytes:   300/300
Decode status:    ok=1 error=-1 bytes=300/3300
Byte corruption:  0.3-1.0% per pattern, 0.5-0.7% aggregate

Sub-1% byte corruption is random 0→1 bit flips at different LED/bit positions per run — the most plausible remaining causes are an unproven MLOFF DMA-race or soldered-loopback signal integrity. Not strict PASS yet; tracked in #3359.

Test plan

  • bash test --unit → 254/254 passed
  • bash lint → clean
  • bash autoresearch teensy41 --object-fled --tx-pin 22 --rx-pin 8 --timeout 60 --skip-lint → deterministic class=decode_mismatch, 300/300 bytes decoded, sub-1% byte corruption, no hang/crash.

How to read the merged history

If you want the diagnostic chronology, follow PR numbers #3351 → #3404 on teensy-fix. The bisection that isolated the pin 8 SELECT_INPUT bug as the root cause of zero_capture is captured in #3391 → #3392 → #3393 → #3394 → #3398 → #3399 → #3402.

Refs: #3359 #3353

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added richer AutoResearch diagnostics for Teensy 4.x, including structured hardware and capture details in test results.
    • Expanded support for legacy chipset and RGBW test modes, plus improved pin configuration handling.
  • Bug Fixes

    • Improved Teensy and FlexIO validation to prevent invalid acceptance runs and clearer failure reporting.
    • Fixed ObjectFLED and capture behavior to better handle RGB/RGBW layouts and busy-state timing.
  • Documentation

    • Updated AutoResearch guidance with clearer platform configuration and diagnostic usage notes.
  • Tests

    • Added broader coverage for Teensy, ObjectFLED, and RPC acceptance scenarios.

zackees and others added 30 commits June 24, 2026 15:03
…ence

[codex] Require AutoResearch capture evidence for PASS
Classifies AutoResearch hardware failures for Teensy/ObjectFLED bring-up.
Synchronize AutoResearch host fallback pins with firmware platform defaults, including Teensy 4.x, ESP32-S3, ESP32-P4, CLI half-overrides, and failed pin-discovery fallback. Validated with focused pytest, ruff, and diff checks.
Queue setPins for every final effective AutoResearch TX/RX pair, including defaults, discovered pins, and discovery fallback. Adds focused coverage for all pin setup paths.
Expose the Teensy FlexIO omitted-TX default through AutoResearch effective pin setup instead of hidden runSingleTest params. Validation: pytest ci/tests/test_autoresearch_phases.py -q; ruff check; ruff format --check; git diff --check.
Require setup RPC pin echoes to match wrapper-requested pins, classify mismatches as pin_state_mismatch, and keep setPins normal-path state in JSON-RPC instead of FL_PRINT.
- remove stale .pio Teensy pre-upload from AutoResearch port detection so fbuild owns deploy
- add AutoResearch runtime output lint for direct FastLED/Serial logging in scoped runtime files
- convert scoped diagnostics to JSON-RPC/JSONL result data
Map Teensy AutoResearch --spi to the registered SPI_UNIFIED driver, wire firmware SPI test/decode paths for SPI_UNIFIED, and harden scoped AutoResearch runtime-output linting.
Adds AutoResearch-attached ObjectFLED register snapshots for issue #3359 S3.
Add current Teensy pin-22 legacy ObjectFLED one-strip coverage and tighten AutoResearch runtime-output lint.
Allow historical legacy multi-lane AutoResearch requests and add same-timing ObjectFLED regression coverage.
Extend AutoResearch runtime-output lint markers to driver .cpp.hpp files and protect ObjectFLED transmit paths.
…WM RX fixes, AutoResearch diagnostics (#3389)

ObjectFLED hardware fixes (S4/S8 related):
- ObjectFLED::begin() now enables CCM_CCGR1/0/2/3 GPIO1-4 clocks before
  remapping fast GPIO6-9 to standard GPIO1-4 via IOMUXC_GPR_GPR26..29.
  Without this, DMA writes to the standard GPIO alias addresses had no
  observable effect on the pad, producing zero RX capture even though
  DMA, TCD, and busy state all reported success.
- New configure_pin_output_aliases() programs both the fast and standard
  GDIR registers as outputs and clears any pending DR bits in both
  aliases so the pad is in a known state before DMA drives it.
- ObjectFLEDDmaManager::waitForCompletion() gains a 250 ms watchdog and
  returns bool, so a stuck DMA fails cleanly instead of spinning forever.

FlexPWM RX corrections (S9 acceptance prerequisite):
- IOMUXC_FLEXPWM*_PWMA*_SELECT_INPUT daisy-chain values were 0 (wrong)
  for pins 8, 22, 23, and 36; corrected to the SION-tied alt entry for
  each pad so the FlexPWM submodule actually samples the wired pin.
- FlexPwmRxChannelImpl::wait() now compares CITER against the value
  captured at configureDma()/arm time, not at wait() entry. The earlier
  sampling falsely classified successful capture as TIMEOUT whenever
  FastLED.wait() drained the TX DMA before wait() was invoked.

Diagnostic surface (S3/S11):
- ObjectFLED snapshot adds CCM_CCGR0..3 plus per-pin standard mode/
  input/output and fast mode registers so diagnostics can prove the
  alias bank is clocked and configured.
- New JSON-RPC probes runSingleTest emits on ObjectFLED runs:
  objectFledStandardGpioProbe (manually toggles TX via standard GPIO
  and reads RX to prove electrical connectivity) and
  objectFledRxCaptureProbe (drives manual pulses while sampling
  FlexPWM RX state through flexPwmRxDiagnosticsToJson()).
- RunResult/runSingleTest response now include per-pattern decodeOk,
  decodeError, decodeBytes, decodeOutputCapacity, and a compact
  rawEdgeSample, so AutoResearch failures can distinguish decode
  failure vs zero capture vs partial capture without serial spam.
- context.py renders the new RX/decode fields and probe summaries
  alongside the existing ObjectFLED diagnostic block.

AutoResearch phase plumbing:
- Removed the broken leading setLaneSizes RPC for --lane-counts; the
  per-lane sizes now ride on the runSingleTest/runParallelTest params
  directly, eliminating a setup-time failure mode and pulling the test
  matrix into a single lane_size_sets list. Existing fan-out semantics
  (drivers x lane_counts x strip_sizes) are preserved.

Validation:
- bash test --unit: 254/254 passed
- bash lint --cpp: clean (PlatformIO-internal-usage warnings unchanged)
- uv run pytest ci/tests/test_autoresearch_phases.py: 81 passed

Refs: #3359

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
zackees and others added 13 commits June 25, 2026 12:51
…c, FlexPWM RX fixes, AutoResearch diagnostics (#3389)" (#3390)

This reverts commit 0527d8d.
…st (#3391)

Adds fl::FlexPwmRxChannel::diagnosticsToJson(pin) - a read-only snapshot
of the active FlexPWM input-capture receiver: IOMUXC mux/select register
live vs expected values, FlexPWM submodule MCTRL/CTRL/CTRL2/DMAEN/
CAPTCTRLA/CAPTCTRLB/CAPTCOMPx, the four CVAL2..CVAL5 capture values,
the receiver DMA channel + DMAMUX + ERQ/HRS/INT/ERR/ES, and the full
TCD descriptor.

Wired into the ObjectFLED branch of runSingleTest so every ObjectFLED
acceptance attempt now returns objectFledDiagnostics AND
flexPwmRxDiagnostics. context.py renders both blocks.

No runtime behavior change in the FlexPWM RX driver, ObjectFLED, or
AutoResearch test loop - this is strictly observability.

First diagnostic run on canonical TX 22 -> RX 8 with this PR confirms
zero-capture root cause is upstream of the receiver: FlexPWM RX is
fully armed (mctrl bit 11 set, captctrla ARMA + EDGA bits set,
dmaen=0x60, dma erq=8) but cval2..cval5 stay at 0 and DMA citer
never decrements, so no edges ever reach the FlexPWM submodule.
That points the next investigation step at whether ObjectFLED's
GPIO1_DR_SET / GPIO1_DR_CLEAR writes actually toggle the standard
GPIO1 alias on pin 22 after IOMUXC_GPR_GPR26 bit 24 is cleared.

Validation:
- bash test --unit: 254/254 passed
- bash lint --cpp: clean (PlatformIO-internal-usage warnings unchanged)
- bash autoresearch teensy41 --object-fled --tx-pin 22 --rx-pin 8
  --timeout 90 --skip-lint: completes in <30s, returns zero_capture
  (no regression), now emits flexPwmRxDiagnostics block

Refs: #3359

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Adds probeStandardGpioPad(tx_pin, rx_pin) that manually drives the TX
pin via the standard GPIO1-4 alias (clearing IOMUXC_GPR_GPR26 bit,
setting the standard GDIR bit, and pulsing standard DR_SET/DR_CLEAR
in software) while reading RX via digitalReadFast. Probe saves and
restores all touched IOMUXC/GPIO state and never touches FlexPWM or
DMA, so it cannot disturb the subsequent ObjectFLED + FlexPWM RX
test run.

Runs once per ObjectFLED runSingleTest before driver setup; result
is attached as response field standardGpioPadProbe and rendered by
context.py.

First-run evidence on canonical TX 22 -> RX 8:
  standardGpioRxHighCount: 5
  standardGpioRxLowCount: 5
  standardGpioConnected: True

Standard GPIO1 alias *does* reach the pad and *does* drive RX
through the soldered loopback. Combined with the prior FlexPWM RX
diagnostic showing cval2..5=0 / citer never decrements, this
isolates the zero-capture failure to ObjectFLED's DMA-driven TX
path itself (pad config, timing, or DMA-vs-pad interaction) -- not
to the standard GPIO bank mapping or to the FlexPWM receiver.

Validation:
- bash test --unit: 254/254 (fingerprint cache; no source changes
  invalidated the unit suite)
- bash lint --cpp: clean (PlatformIO-internal-usage warn-only
  baseline unchanged)
- bash autoresearch teensy41 --object-fled --tx-pin 22 --rx-pin 8
  --timeout 120 --skip-lint: completes normally, returns
  zero_capture (no regression), new probe emits success.

Refs: #3359

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…FLED actually programs) (#3393)

ObjectFLED wires TMR4 to DMA via xbar_connect() with output indices
XBARA1_OUT_DMA_CH_MUX_REQ30=0, REQ31=1, REQ94=2 (Teensy core macros).
xbar_connect() therefore writes to XBARA1_SEL0 (outputs 0 + 1) and
XBARA1_SEL1 (outputs 2 + 3), NOT to SEL15 / SEL47 the existing
snapshot was reading. Adds xbar.sel0 / xbar.sel1 fields to every
snapshot event.

First diagnostic run on canonical TX 22 -> RX 8 confirms:
  xbar.sel0=0x2524  -> output 0 src=0x24=36 (QTIMER4_TIMER0)
                       output 1 src=0x25=37 (QTIMER4_TIMER1)
  xbar.sel1=0x0026  -> output 2 src=0x26=38 (QTIMER4_TIMER2)

So the TMR4 -> XBAR -> DMAMUX -> DMA chain is wired exactly as
ObjectFLED requests. Combined with the existing evidence
(DMA citer decrements, dma1 daddr cycles GPIO1..4_DR_SET, dma2/dma3
daddr cycles GPIO1..4_DR_CLEAR, standard-bank DR_SET / DR_CLEAR
writes via the probe reach the pad), the TX-side hardware program
is internally consistent with WS2812 generation. Zero capture is
still observed; root cause remains in a layer the current
diagnostics do not yet expose.

No runtime behavior change.

Validation:
- bash test --unit: 254/254 passed
- bash lint --cpp: clean
- bash autoresearch teensy41 --object-fled --tx-pin 22 --rx-pin 8
  --timeout 120 --skip-lint: completes normally, returns
  zero_capture (no regression), new xbar.sel0/sel1 fields render.

Refs: #3359

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
… pad probe (#3394)

Extends probeStandardGpioPad with a 50-iteration tight-loop section
that writes HIGH to GPIO1_DR_SET, reads RX with digitalReadFast (no
delay), writes LOW to GPIO1_DR_CLEAR, reads RX (no delay), and
measures the success rate both at zero-delay and after 200 ns
settle.

First diagnostic run on canonical TX 22 -> RX 8:
  fastToggleHighSettled: 50
  fastToggleLowSettled:  50
  fastToggleHighZeroDelay: 50
  fastToggleLowZeroDelay: 50

Standard GPIO1_DR_SET / GPIO1_DR_CLEAR writes propagate to the pad
and back to digitalReadFast within a CPU-bus-cycle window -- much
faster than WS2812's 1.25 us bit period. This rules out:
- Standard alias propagation delay
- Pad rate-limiting / signal-integrity
- Pull/keeper/drive strength

Conclusion: ObjectFLED's DMA TX path is the failure surface; the
standard alias itself is rate-tolerant at WS2812 speeds and faster.

No runtime behavior change in driver / test loop.

Refs: #3359

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…#3395)

ty was failing on every `_is_plain_int(x) and x > 0` style guard in
phases.py because the predicate returned plain bool, so the
subsequent `>` / `<=` comparisons saw `Any | None` instead of
narrowed `int`. Annotating the predicate as `TypeGuard[int]` lets
ty narrow correctly and turns the seven existing comparison-side
errors into no-ops at runtime (logic unchanged).

Refs: #3359 (Stop-hook unblock)

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…xpwm-rx-diag (#3398)

Extends FlexPwmRxChannel::diagnosticsToJson with the RX pin's PAD
control register and the fast + standard GPIO bank GDIR / PSR /
GPR slots. Lets a failing run prove whether the FlexPWM input pad
inherited any non-zero pull / keeper / HYS / ODE bit from boot or
from a prior driver, and whether the input pad bank is mapped
to the fast or standard alias when capture is attempted.

First diagnostic run on canonical TX 22 -> RX 8:
  rxBit=16, rxMask=0x10000
  rxPadValue=0x38   -> DSE=7, PKE=0, PUE=0, ODE=0, SPEED=0, SRE=0, HYS=0
  rxFastGpioBank=7, rxStandardGpioBank=2
  rxFastModeValue=0, rxStandardModeValue=0      (input)
  rxFastInputValue=6, rxStandardInputValue=6   (pad bit 16 LOW)
  rxGprValue=0xFFFFFFFF                          (pad on fast GPIO7)
  rxMappedToStandard=False

Pad / mode / GPR / PSR all reasonable for an idle input pin at
end-of-frame, but the actual data point we are after is whether
this state changes WHILE ObjectFLED is transmitting. The snapshot
is taken after `FastLED.wait()` returns, so for a stuck RX it will
remain LOW; future work will sample at multiple stages.

No runtime behavior change.

Validation:
- bash test --unit: 254/254
- bash lint --cpp: clean (PlatformIO-internal-usage warn-only)
- bash autoresearch teensy41 --object-fled --tx-pin 22 --rx-pin 8
  --timeout 120 --skip-lint: completes, zero_capture (no regression),
  new rxPad/rxFast/rxStandard fields render under flexPwmRxDiagnostics.

Refs: #3359

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…3399)

Adds objectFledDiagnosticsSetRxPin(int) and records the RX pin's
fast + standard GPIO PSR (and bit/mask) inside every snapshot
event. afterShowReturn is captured while DMA is still actively
driving TX, so a HIGH bit at that stage proves the RX pad does
see the signal end-to-end.

First diagnostic run on canonical TX 22 -> RX 8:
  stage=afterShowReturn -> rx.fastHigh=1 (rx.fastPsr=0x10006)
  stage=afterFastLedWait -> rx.fastHigh=0

Conclusion: pin 8 pad DOES see the WS2812 signal. ObjectFLED's
DMA-driven TX path through GPIO1_DR_SET/CLEAR is producing
visible edges on the wire. The zero_capture is purely a
FlexPWM-RX-side defect: the input-capture submodule is correctly
armed (mctrl, captctrla, dmaen, mux+SION all match expected) but
the IOMUXC FLEXPWM*_SELECT_INPUT daisy-chain value is wrong for
pin 8 (currently 0 = GPIO_SD_B1_00, should be 4 = GPIO_B1_00).
Fix to follow in a separate, focused PR.

No runtime behavior change in this commit.

Refs: #3359

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…MA completion ISR (#3400)

Two coupled changes that move ObjectFLED+FlexPWM-RX acceptance from
zero_capture to decode_mismatch (real capture data flowing):

1. Pin 8 SELECT_INPUT was 0 (GPIO_SD_B1_00 - an unrelated pad),
   so FlexPWM1 SM3 channel A never saw the pin 8 signal even
   though IOMUX + SION routed pin 8's input to FlexPWM. Corrected
   to 4 (GPIO_B1_00) per i.MX RT1062 IOMUXC_FLEXPWM1_PWMA3_
   SELECT_INPUT table. Diagnostic evidence from #3399 showed pin 8
   pad actually toggled HIGH during ObjectFLED's DMA TX
   (rx.fastHigh=1 at afterShowReturn) while FlexPWM RX still
   reported cval2..5=0 - exactly the SELECT_INPUT-pointed-at-wrong-
   pad signature.

2. With SELECT_INPUT corrected, registering the DMA major-loop
   completion ISR caused runSingleTest to hang past the 120 s RPC
   timeout (firmware ACKs but never returns). Removing the
   `interruptAtCompletion()` + `attachInterrupt(dmaIsr)` calls
   restored normal execution. wait() already terminates via the
   CITER-inactivity branch (mSignalRangeMaxNs), so the ISR is a
   convenience the driver does not need. Root-cause investigation
   of the ISR-induced hang is deferred to a follow-up - the
   immediate priority is unblocking acceptance.

Hardware result (bash autoresearch teensy41 --object-fled
--tx-pin 22 --rx-pin 8 --timeout 60 --skip-lint):
  TEST OBJECT_FLED lanes=1 leds=100 FAIL 31 ms class=decode_mismatch
  cval2=27599 cval3=27633 citer=1696 (was 4096)
  -> 2400 minor loops fired = one full WS2812 frame captured

decode_mismatch (not zero_capture) is real progress and the next
debugging surface is decoder-side, not RX-side. PASS still requires
the captured bytes to match the expected pattern.

Refs: #3359

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
… reconfig (#3402)

Combines the routing fix from the reverted #3400 with the actual
DMA defensive sequence that makes it safe across multiple test
patterns.

1. Pin 8 SELECT_INPUT 0 -> 4 (GPIO_B1_00 = pin 8 per i.MX RT1062
   IOMUXC_FLEXPWM1_PWMA3_SELECT_INPUT table).

2. configureDma() now disables the DMA channel and clears any
   pending completion / interrupt / error flag before rewriting
   the TCD. Each capture() call invokes configureDma() afresh,
   and the previous pattern may have left ERQ set with an
   in-flight minor loop. Modifying the TCD while a transfer is
   active is undefined behavior on i.MX RT eDMA and was the
   trigger for the runSingleTest hang / DACCVIOL we saw the first
   time pin 8 SELECT_INPUT actually pointed at the pin (#3401
   revert evidence). Quiescing first makes the re-arm safe and
   the dmaIsr completion path can stay attached.

Hardware result (bash autoresearch teensy41 --object-fled
--tx-pin 22 --rx-pin 8 --timeout 60 --skip-lint, two consecutive
runs):
  Run 1: TEST OBJECT_FLED lanes=1 leds=100 FAIL 31 ms
         class=decode_mismatch
         cval2=27520 cval3=27554 citer=1696
  Run 2: TEST OBJECT_FLED lanes=1 leds=100 FAIL 31 ms
         class=decode_mismatch
         cval2=27635 citer=1696

Deterministic. No hang, no crash. Each test pattern captures one
full WS2812 frame (2400 minor loops out of the 4096-CITER buffer)
and the decoder can now operate on real edge data. Bytes-decoded
is still 0/300 - that is a decoder/timing issue, not an RX-path
issue, and will be addressed in a follow-up.

Refs: #3359

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…estore decode diagnostics (#3403)

The FlexPWM RX wait() loop was sampling CITER at wait-entry and
declaring TIMEOUT when CITER had not changed since. But capture()
calls FastLED.wait() BEFORE rx_channel->wait() -- by the time we
enter wait() the TX has already completed and the RX DMA may
have already drained one frame. CITER at wait-entry == CITER now,
so dma_progressed = false, so wait() returns TIMEOUT, so capture()
returns 0 without ever decoding the perfectly-good buffer.

Switched to comparing against `mArmedCiter`, captured at
configureDma() right after BITER is set. Now wait() correctly
returns SUCCESS whenever DMA progressed since arm, regardless of
whether the progress happened before or during the wait() call
itself.

Also re-introduces the decode-side RunResult fields that were
collateral damage of the #3390 revert: decodeOk, decodeError,
decodeBytes, decodeOutputCapacity, rawEdgeSample. context.py
renders them, and AutoResearchRemoteRunSingleTest emits them
under each pattern. Without these fields the failure was opaque -
they are what proved decode was never called.

Hardware result (bash autoresearch teensy41 --object-fled
--tx-pin 22 --rx-pin 8 --timeout 60 --skip-lint):
  TEST OBJECT_FLED lanes=1 leds=100 FAIL 32 ms class=decode_mismatch
  Captured bytes:  300/300
  Decode status:   ok=1 error=-1 bytes=300/3300
  Byte corruption: 0.3%-1.3% per pattern, 0.6% aggregate (7/1200)

Driver now produces nearly-correct WS2812 output end-to-end on the
canonical TX22 -> RX8 loopback. Sub-1% byte corruption is a timing
tolerance or single-bit-flip issue, not a structural defect.

Refs: #3359

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Three more FlexPWM input-capture daisy-chain values were wrong --
same class of bug as #3402's pin 8 fix. Independent audit (subagent
A) cross-checked every pin in the kPinMap[] against the i.MX RT1062
IOMUXC_FLEXPWM*_SELECT_INPUT tables and identified these three:

  Pin | Pad             | Register                                 | Was | Should be
  ----+-----------------+------------------------------------------+-----+-----------
  22  | GPIO_AD_B1_08   | IOMUXC_FLEXPWM4_PWMA0_SELECT_INPUT       |  0  |  1
  23  | GPIO_AD_B1_09   | IOMUXC_FLEXPWM4_PWMA1_SELECT_INPUT       |  0  |  1
  36  | GPIO_B1_02      | IOMUXC_FLEXPWM2_PWMA3_SELECT_INPUT       |  1  |  4

With the wrong DAISY value the FlexPWM submodule listens to an
unrelated pad, so any AutoResearch run that uses one of these pins
as RX would silently fail with zero capture -- exactly the
signature pin 8 produced before #3402.

The canonical TX 22 -> RX 8 test is unaffected (it uses pin 8 as
RX, which is already correct). Hardware sanity-checked: the test
still reports `class=decode_mismatch` with 99.4% bit accuracy (8/1200
byte corruption) -- no regression.

Subagent A also confirmed every other pin in kPinMap[] is correct:
pins 2, 4, 5, 6, 8, 29, 49, 53, 54.

Audit cross-references:
- i.MX RT1062 IOMUXC daisy-chain tables (chapter on IOMUXC)
- Teensy core imxrt.h IOMUXC_FLEXPWM*_SELECT_INPUT defines
- pwm.c xbar_connect() implementation
- Existing diagnostic snapshot evidence (flexPwmRxDiagnostics)

Refs: #3359

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jun 26, 2026
@zackees
zackees merged commit 72184c0 into master Jun 26, 2026
6 of 10 checks passed
@zackees
zackees deleted the teensy-fix branch June 26, 2026 01:59
@coderabbitai

coderabbitai Bot commented Jun 26, 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: c0027061-c01f-4e3e-a883-a8543d997e56

📥 Commits

Reviewing files that changed from the base of the PR and between 96aa404 and 8281805.

📒 Files selected for processing (47)
  • agents/docs/hardware-autoresearch.md
  • ci/autoresearch/args.py
  • ci/autoresearch/context.py
  • ci/autoresearch/gpio.py
  • ci/autoresearch/phases.py
  • ci/autoresearch/staging.py
  • ci/debug_attached.py
  • ci/lint_cpp_rs/src/checkers/style.rs
  • ci/lint_cpp_rs/src/lint_core/processor_registry_cli.rs
  • ci/lint_cpp_rs/src/lint_core/regexes.rs
  • ci/lint_cpp_rs/src/lint_core/tests.rs
  • ci/tests/test_autoresearch_phases.py
  • ci/tests/test_autoresearch_rpc_acceptance.py
  • ci/tests/test_autoresearch_staging.py
  • ci/tests/test_debug_attached_lint.py
  • examples/AutoResearch/AutoResearch.ino
  • examples/AutoResearch/AutoResearchRemote.cpp
  • examples/AutoResearch/AutoResearchRemoteAsyncMethods.cpp
  • examples/AutoResearch/AutoResearchRemoteDriverMethods.cpp
  • examples/AutoResearch/AutoResearchRemotePinMethods.cpp
  • examples/AutoResearch/AutoResearchRemoteRunParallelTest.cpp
  • examples/AutoResearch/AutoResearchRemoteRunSingleTest.cpp
  • examples/AutoResearch/AutoResearchRemoteSystemMethods.cpp
  • examples/AutoResearch/AutoResearchTest.cpp
  • examples/AutoResearch/AutoResearchTest.h
  • examples/AutoResearch/LegacyClocklessProxy.h
  • src/fl/channels/channel.cpp.hpp
  • src/fl/channels/data.cpp.hpp
  • src/fl/channels/data.h
  • src/platforms/arm/teensy/teensy4_common/clockless_objectfled.cpp.hpp
  • src/platforms/arm/teensy/teensy4_common/clockless_objectfled.h
  • src/platforms/arm/teensy/teensy4_common/drivers/objectfled/_build.cpp.hpp
  • src/platforms/arm/teensy/teensy4_common/drivers/objectfled/channel_engine_objectfled.cpp.hpp
  • src/platforms/arm/teensy/teensy4_common/drivers/objectfled/channel_engine_objectfled.h
  • src/platforms/arm/teensy/teensy4_common/drivers/objectfled/iobjectfled_peripheral.h
  • src/platforms/arm/teensy/teensy4_common/drivers/objectfled/objectfled_diagnostics.cpp.hpp
  • src/platforms/arm/teensy/teensy4_common/drivers/objectfled/objectfled_diagnostics.h
  • src/platforms/arm/teensy/teensy4_common/drivers/objectfled/objectfled_peripheral_real.cpp.hpp
  • src/platforms/arm/teensy/teensy4_common/rx_flexpwm_channel.cpp.hpp
  • src/platforms/arm/teensy/teensy4_common/rx_flexpwm_channel.h
  • src/platforms/shared/mock/arm/teensy4/drivers/objectfled/objectfled_peripheral_mock.h
  • src/third_party/object_fled/src/ObjectFLED.h
  • src/third_party/object_fled/src/OjectFLED.cpp.hpp
  • tests/fl/channels/data.cpp
  • tests/meson.build
  • tests/platforms/arm/teensy/teensy4_common/drivers/objectfled/channel_engine_objectfled.cpp
  • tests/platforms/esp/32/drivers/uart/channel_driver_uart.cpp

📝 Walkthrough

Walkthrough

Teensy AutoResearch gains structured JSON RPC output, stricter host-side validation, new legacy and pin-selection options, and updated ObjectFLED/FlexPWM diagnostics. Channel data now carries explicit pixel-format metadata, and the runtime-output linting path is extended for AutoResearch sources.

Changes

Channel pixel-format contract

Layer / File(s) Summary
Pixel-format metadata
src/fl/channels/data.h, src/fl/channels/data.cpp.hpp, src/fl/channels/channel.cpp.hpp, tests/fl/channels/data.cpp, tests/platforms/esp/32/drivers/uart/channel_driver_uart.cpp
ChannelData now stores an explicit pixel format, showPixels sets it before encoding, and the generic channel/UART tests pass the format through.
ObjectFLED runtime diagnostics
src/third_party/object_fled/src/*, src/platforms/arm/teensy/teensy4_common/drivers/objectfled/objectfled_diagnostics.*, src/platforms/arm/teensy/teensy4_common/rx_flexpwm_channel.*, src/platforms/shared/mock/arm/teensy4/drivers/objectfled/objectfled_peripheral_mock.h
ObjectFLED gains raw-frame output, busy-state tracking, diagnostics snapshots, and FlexPWM RX JSON telemetry through the real and mock peripherals.
Async ObjectFLED engine
src/platforms/arm/teensy/teensy4_common/clockless_objectfled.*, src/platforms/arm/teensy/teensy4_common/drivers/objectfled/channel_engine_objectfled.*, tests/platforms/arm/teensy/teensy4_common/drivers/objectfled/channel_engine_objectfled.cpp
ObjectFLED channel submission now groups by timing and pixel format, flushes on end-frame, and the engine tests cover the new BUSY/DRAINING flow.

AutoResearch RPC payloads

Layer / File(s) Summary
AutoResearch RPC payloads
examples/AutoResearch/AutoResearch.ino, examples/AutoResearch/AutoResearchRemote*.cpp, examples/AutoResearch/AutoResearchTest.*, examples/AutoResearch/LegacyClocklessProxy.h
The sketch, remote methods, and shared test harness now emit structured JSON status, carry capture evidence, and thread legacy-chipset, RGBW, and TX-mux settings through the RPC path.

AutoResearch host setup and validation

Layer / File(s) Summary
Teensy startup and pin setup
agents/docs/hardware-autoresearch.md, ci/autoresearch/{args.py,context.py,gpio.py,phases.py,staging.py}, ci/debug_attached.py, ci/tests/{test_autoresearch_phases.py,test_autoresearch_staging.py,test_debug_attached_lint.py}, tests/meson.build
Docs, CLI flags, environment defaults, and startup tests add Teensy-specific pin selection, root PlatformIO rejection, and build/tooling updates for AutoResearch startup.
RPC validation and acceptance
ci/autoresearch/{context.py,phases.py}, ci/tests/test_autoresearch_rpc_acceptance.py
RPC validation now checks setup and test response shapes, classifies failures, and the acceptance tests cover capture evidence, pin agreement, and decode or zero-capture cases.

Runtime-output linting

Layer / File(s) Summary
Runtime-output linting
ci/lint_cpp_rs/src/{checkers/style.rs,lint_core/processor_registry_cli.rs,lint_core/regexes.rs,lint_core/tests.rs}
A new checker flags forbidden runtime output in AutoResearch C++ sources, is registered in the Rust CLI, and is covered by marker-scope and safe-pattern tests.

Sequence Diagram(s)

sequenceDiagram
  participant Phases as ci.autoresearch.phases
  participant RpcClient
  participant SingleTest as AutoResearchRemoteRunSingleTest
  participant ParallelTest as AutoResearchRemoteRunParallelTest
  participant Context as ci.autoresearch.context
  Phases->>RpcClient: send runSingleTest / runParallelTest
  RpcClient->>SingleTest: invoke RPC
  RpcClient->>ParallelTest: invoke RPC
  SingleTest-->>RpcClient: JSON response with capture evidence
  ParallelTest-->>RpcClient: JSON response with totals and evidence
  RpcClient-->>Phases: responses
  Phases->>Context: display_pattern_details / display_objectfled_diagnostics
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~90+ minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#3290: Extends the same AutoResearch --use-root-platformio-ini path and Teensy acceptance guard.
  • FastLED/FastLED#3187: Changes the same AutoResearch RPC split and result-field plumbing used by the new single/parallel test paths.
  • FastLED/FastLED#3216: Touches the same Teensy FlexPWM RX driver area and its diagnostics/DMAs.

Poem

I hopped through pins and bytes at dawn,
and watched the noisy logs stay gone.
With JSON sparkle, busy hops, and beam,
the Teensy burrow hums like a stream.
🐰✨

✨ 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 teensy-fix

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