Repository navigation
Description
TL;DR
Single source of truth for the Teensy 4 channels-API driver and verification work. Supersedes #2764 (the FlexIO-RX bootstrap meta whose Phase 1-4 shipped and whose Phase 5+ framing is now stale) and #3006 (standalone LPUART feature ticket; folded inline below). Cross-references the cross-driver wave8 test + shared ISR-mock fixture work that came out of recent coverage discussions but had never been filed.
Current registry state on Teensy 4.x (master)
After #3005 (driver-name fix) and #3010 (parlio mock ISR pump) merged on 2026-06-13/14:
| Bus | Priority | Engine | Pin set | Async? |
|---|---|---|---|---|
Bus::FLEX_IO |
8 | ChannelEngineFlexIO |
FlexIO2-capable: {6-13, 32} | sync (peripheral->wait() inline) |
Bus::OBJECT_FLED |
5 | ChannelEngineObjectFLED |
any GPIO | sync by design |
Bus::BIT_BANG |
0 | shared bitbang fallback | any GPIO | sync |
AutoResearch can now drive both FLEX_IO and OBJECT_FLED from Python via --flex-io and --object-fled (or --all). FlexIO RX loopback fixture from old #2764 Phase 3 is in place and proven against ObjectFLED TX. Host channels tests pass; full host suite (bash test --cpp) goes green on Linux CI after #3010.
✅ Done (linked for history, no action needed)
- FlexIO RX backend (was [meta] Bootstrap AutoResearch driver development for Teensy 4.0 — FlexIO RX + first LED driver verification #2764 Phases 1A–4): feat(rx): FlexIO RX backend skeleton (Phase 1A of #2764) #2765, feat(rx): FlexIO RX hardware programming (Phase 1B of #2764) #2766, feat(autoresearch): flexioRxBenchmark RPC + Python harness (Phase 2 of #2764) #2767, feat(autoresearch): ObjectFLED → FlexIO RX loopback + WS2812 decoder (Phase 3 of #2764) #2769, docs(rx/flexio): FlexIO RX backend docs + enum-comment refresh (Phase 4 of #2764) #2770, plus HardFault fix
7bda3e402(closed FlexIO RX begin() hangs on real Teensy 4.0 silicon — WDOG3 fires (#2764 Phase 5 follow-up) #2772). - AutoResearch driver-name fix (fix(autoresearch): exercise both ObjectFLED and FlexIO on Teensy 4.x #3005, merged): orchestrator now sends
OBJECT_FLED/FLEX_IOinstead of the silently-rejectedOBJECTFLED; FlexIO test pins to a FlexIO2-capable TX pin so the engine actually engages. - parlio mock ISR pump (fix(parlio): mock waitAllDone() pumps deferred ISR callbacks to mirror real-DMA semantics (#2992 follow-up) #3010, merged): mock
waitAllDone()anddeinitialize()now drive aParlioEngine::poll()tick to mirror the post-feat: add ISR-backed channel poll wakeups #2992 async semantics. Unblocks master CI. ThesettleEngineState()shape it adds is the pattern the future LPUART peripheral mock should adopt from day one.
🚧 Open work (the actual planning content)
A) Bus::LPUART — third orthogonal clockless peripheral on Teensy 4
Folded in from #3006. Adds the iMXRT1062 LPUART (inverted-TX + eDMA) as a wave8-generic clockless driver. Not WS2812-specific — the peripheral's only wire-shape constraint is "every bit cell starts HIGH and ends LOW with 8 freely-programmable pulses in between," which is the topology of every WS281x-family / SK6812 / UCS7604 / TM181x chipset. The legacy CWS2812SerialController and PaulStoffregen library are one possible WS2812-only special case of what this engine should support generically.
Why it matters: disjoint hardware path from FlexIO and ObjectFLED — a sketch can run strips on all three peripherals concurrently. T4 has 8 LPUART instances (LPUART1..LPUART8), so up to ~8 additional async strips are possible once Phase 3 async lands.
Backend strategy (decided): direct iMXRT LPUART + eDMA register driver using wave8 from day one — not a wrap of the legacy PaulStoffregen library. The library hard-codes WS2812 byte patterns + baud, which would have to be thrown away when Phase 3 async lands anyway; wrapping it first is rework.
Phase 1 — sync engine + registration:
-
src/fl/channels/bus.h— shipped in feat(channels): reserve Bus::LPUART enum slot (refs #3023) #3026 (merged):- Add
LPUARTenumerator afterOBJECT_FLED. - Add
case Bus::LPUART: return "LPUART";tobusName(). - Bump the drift-prevention
FL_STATIC_ASSERT(static_cast<fl::u8>(Bus::STUB) == 13, ...)to 14.
- Add
-
src/platforms/arm/teensy/teensy4_common/drivers/lpuart/(new directory):-
ilpuart_peripheral.h— abstract interface (mirrorsiparlio_peripheral.h) so the engine is host-testable via a mock. Shipped in feat(lpuart): scaffold Teensy 4 LPUART peripheral interface + host mock (refs #3023) #3032 (merged). -
lpuart_peripheral_real.{h,cpp.hpp}— iMXRT register driver.LPUARTx_CTRL.TXINV=1, 8-N-1 framing, eDMA via DMAMUX source for LPUARTx TX. Pin-mux table covering the T4.0/4.1 LPUART-TX pins {1, 8, 14, 17, 20, 24, 29, 35, 47, 48}. ← needs hardware verification, deferred. -
lpuart_peripheral_mock.{h,cpp.hpp}— host-stub mock. Shipped in feat(lpuart): scaffold Teensy 4 LPUART peripheral interface + host mock (refs #3023) #3032 (merged). Streaming-ISRsettleEngineState()pattern deferred until workstream C lands the shared template fixture; current mock is sync-only. -
wave8_encoder_lpuart.{h,cpp.hpp}— packs aWave8Byteinto the 8 programmable UART data bits per frame (start/stop framing handled by the inverted hardware). -
channel_engine_lpuart.{h,cpp.hpp}—IChannelDriversubclass. Syncshow()for Phase 1. -
bus_traits.h—BusTraits<Bus::LPUART>mirroringobjectfled/bus_traits.h;BusSupports<Bus::LPUART, ClocklessChipset> : fl::true_type. -
_build.cpp.hppfor the mock side — shipped in feat(lpuart): scaffold Teensy 4 LPUART peripheral interface + host mock (refs #3023) #3032. Engine-side_build.cpp.hppdeferred until engine TU lands.
-
-
src/platforms/arm/teensy/teensy4_common/init_channel_driver_mxrt1062.cpp.hpp— register at priority 3 (between BIT_BANG=0 and OBJECT_FLED=5; LPUART is single-strip + pin-restricted, so lower than ObjectFLED's any-pin parallel fan-out). -
src/platforms/arm/teensy/channel_drivers_teensy.impl.hpp— appendBus::LPUARTto theenableDrivers<...>()pack in theFL_IS_TEENSY_4Xarm.
canHandle() — wave8-generic, not chipset-specific:
bool ChannelEngineLPUART::canHandle(const ChannelDataPtr& data) const FL_NOEXCEPT {
if (!data || !data->isClockless()) return false;
const ChipsetTiming& t = data->getTiming();
// (1) Bit period must fit the LPUART baud-rate range (~1067 ns – 160 us on iMXRT)
if (t.total_period_ns() < kLPUARTMinBitPeriodNs ||
t.total_period_ns() > kLPUARTMaxBitPeriodNs) return false;
// (2) Wave8 expansion must have leading HIGH and trailing LOW
// (the inverted-LPUART framing constraint)
auto lut = buildWave8ByteExpansionLUT(buildWave8ExpansionLUT(t));
if ((lut.lut[0x00].symbols[0].data & 0x80) == 0) return false; // first pulse HIGH
if ((lut.lut[0xFF].symbols[7].data & 0x01) != 0) return false; // last pulse LOW
return mPeripheral->canHandlePin(static_cast<u8>(data->getPin()));
}New chipsets in the WS281x topology land for free as long as their wave8 expansion fits.
Phase 2 — AutoResearch wiring (follows #3005's pattern): ✅ shipped in #3033 (merged).
-
examples/AutoResearch/AutoResearchRemote.cpp:943-944—else if (n == "LPUART") opts.mBus = fl::Bus::LPUART;. (feat(autoresearch): wire LPUART driver into --lpuart and --all (refs #3023) #3033) -
ci/autoresearch/args.py—--lpuartflag +lpuart: boolfield onArgs. (feat(autoresearch): wire LPUART driver into --lpuart and --all (refs #3023) #3033) -
ci/autoresearch/phases.py—"LPUART"in--alland per-flag mapping. PinpinTx=1whendriver=="LPUART"(T4 default TX is pin 1 = LPUART6 TX), analogous to thepinTx=6override for FLEX_IO that fix(autoresearch): exercise both ObjectFLED and FlexIO on Teensy 4.x #3005 added. (feat(autoresearch): wire LPUART driver into --lpuart and --all (refs #3023) #3033) -
ci/tests/test_autoresearch_phases.py— update--allset + addlpuart=Falseto_make_args. (feat(autoresearch): wire LPUART driver into --lpuart and --all (refs #3023) #3033, also patches pre-existingpin_toggle_rx/ws2812_loopbackbreakage.) - Hardware verification reuses the existing FlexIO RX loopback fixture (the
flexioObjectFledTestRPC handler atAutoResearchRemote.cpp:1517— swapopts.mBus = fl::Bus::LPUARTto point at the new driver). ← blocked on Phase 1 engine + real driver.
Phase 1 acceptance:
-
bash compile teensy40 --examples AutoResearchsucceeds with the new engine. -
bash autoresearch teensy40 --lpuart(Phase 2 hardware run) drives one strip via LPUART-eDMA on pin 1, captured byte-for-byte via the FlexIO RX loopback. -
bash autoresearch teensy40 --allexercises FLEX_IO + OBJECT_FLED + LPUART in sequence. - Host stub build still passes (engine TU gated by
FL_IS_TEENSY_4X). - Parameterized host test in
tests/platforms/arm/teensy/teensy4_common/drivers/lpuart/channel_engine_lpuart.cppconfirmscanHandle()accepts WS2812, WS2812B, WS2812B-V5, SK6812, SK6812-RGBW and rejects APA102, SK9822 (clocked SPI), plus any chipset whose wave8 expansion violates the leading-HIGH/trailing-LOW topology. - Legacy
FastLED.addLeds<WS2812SERIAL, DATA_PIN, GRB>(...)template path remains functional (no regressions; no removal of the#define USE_WS2812SERIALgate on the legacy path). -
ChannelManagerboot dump lists all four T4.x clockless options:BIT_BANG (pri 0), LPUART (pri 3), OBJECT_FLED (pri 5), FLEX_IO (pri 8).
B) Cross-driver wave8 byte-equivalence test
Single host test that feeds the same CRGB array through every wave8-using driver's encoder (parlio, i2s, spi, uart, future lpuart) and asserts the wire output is bit-identical modulo per-driver framing. Catches encoder drift between drivers and (more importantly) LUT-rebuild bugs when someone touches the shared wave8.cpp.hpp. The single highest-ROI test we don't have today.
-
tests/fl/channels/wave8.cpp— LUT-regression piece shipped in test(channels): widen wave8 LUT regression matrix to real chipset timings (refs #3023) #3028 (merged): three new test cases walk 10 real chipset timings (WS2812, WS2812B-V5, WS2813, SK6812, UCS1903B, TM1809, PL9823, WS2811, WS2815, UCS1903_400KHZ) and assert (1) byte-LUT == nibble-LUT for all 256 input bytes, (2) the wave8 framing invariant (first pulse HIGH, last pulse LOW) — the topology LPUART'scanHandle()rests on, and (3)wave8Transpose_4matches between the two LUT-typed overloads. Appended to the existingwave8.cppinstead of the originally-planned standalonewave8_cross_driver.cpp(test-pairing hook requires a matchingsrc/header — the existing file pairs withwave8.h). - Per-driver byte-stream capture comparison (the literal "feed CRGB through every driver's mock and compare framed bytes") — deferred until workstream C extracts the shared streaming-ISR mock fixture so each driver's mock has a uniform capture API.
- Reference: discussion in this PR thread — "What's the theoretical test coverage for wave8 across all these drivers."
C) Shared streaming-ISR mock fixture
Lift the parlio_peripheral_mock deferred-callback + settleEngineState() plumbing into a reusable template fixture so i2s / uart / spi / future lpuart don't each re-derive it.
-
tests/platforms/shared/streaming_isr_mock.h— templated overIPeripheral. Provides deferred-callback queue, configurable txDone delay, settle-on-waitAllDone()/deinitialize()hooks (mirroring fix(parlio): mock waitAllDone() pumps deferred ISR callbacks to mirror real-DMA semantics (#2992 follow-up) #3010). - Migrate
parlio_peripheral_mockto use the shared fixture (proves the abstraction). - Apply to
lpuart_peripheral_mockfrom day one (workstream A above).
D) Phase 3 — wave8 streaming-ISR async conversion per driver
Per-driver follow-up tickets (file each as its own issue once the corresponding Phase 1 sync engine lands). Reference patterns:
src/platforms/esp/32/drivers/parlio/parlio_engine.cpp.hpp— "PHASE 1: ASYNC MODE" sections (the original wave8 + ISR ring buffer impl).src/platforms/esp/32/drivers/i2s/channel_driver_i2s.{h,cpp.hpp}— wave8 streaming via I2S half/done ISRs.- feat: add ISR-backed channel poll wakeups #2992 — ISR-backed channel
poll()wakeups; thechannel_poll_signalplumbing the conversions sit on.
Workstreams:
- LPUART async (lets up to 8 LPUART strips run fully in parallel without blocking).
- Review FlexIO engine for async parity — currently
wait()is called inline per channel; could become poll-driven. - ObjectFLED async — library is synchronous-by-design; non-trivial to convert.
🗂 Retired predecessors (closed for history)
- [meta] Bootstrap AutoResearch driver development for Teensy 4.0 — FlexIO RX + first LED driver verification #2764 — original FlexIO RX bootstrap meta. Phases 1-4 shipped; phases 5+ subsumed into workstream A + the verification fixtures here. Closed as superseded.
- feat(teensy4/channels): add Bus::LPUART — generic wave8-over-LPUART driver (third orthogonal peripheral; sync-first, streaming-ISR async as follow-up) #3006 — standalone LPUART feature ticket. Fully folded into workstream A above. Closed as superseded.
Reference (post-merge cleanup needed)
src/platforms/arm/teensy/teensy31_32/ws2812serial_controller.h+ theaddLeds<WS2812SERIAL>template overload atsrc/FastLED.h:1265-1276stay untouched. The legacy template path keeps working for existing user sketches;Bus::LPUARTis the channels-API forward path.
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Jun 14, 2026
Progress update (2026-06-14)
Shipped two foundation PRs against this meta:
feat(channels): reserve Bus::LPUART enum slot (refs #3023) #3026 (
feat/lpuart-bus-enum): ReservesBus::LPUARTenum slot insrc/fl/channels/bus.h, adds the matchingbusName()case, and bumps the drift-preventionFL_STATIC_ASSERTfromBus::STUB == 13→14. This is the first checkbox of workstream A Phase 1.test(channels): widen wave8 LUT regression matrix to real chipset timings (refs #3023) #3028 (
feat/wave8-cross-driver-test): Adds three host test cases totests/fl/channels/wave8.cppcovering the wave8 LUT regression matrix across 10 real chipset timings (WS2812, WS2812B-V5, WS2813, SK6812, UCS1903B, TM1809, PL9823, WS2811, WS2815, UCS1903_400KHZ). Asserts:Bus::LPUART::canHandle()will rely onwave8Transpose_4matches between the two LUT-typed overloadsThis is workstream B scaled to the LUT-regression target. The per-driver byte-stream comparison piece is deferred until workstream C's shared streaming-ISR mock fixture exists.
Still open
lpuart_peripheral_real.cpp.hpp(iMXRT register driver + eDMA + DMAMUX),lpuart_peripheral_mock,wave8_encoder_lpuart,channel_engine_lpuart,bus_traits.h, registration ininit_channel_driver_mxrt1062.cpp.hpp, and host tests forcanHandle()accept/reject. Hardware verification required.--lpuartwiring (AutoResearchRemote.cpp,ci/autoresearch/args.py,ci/autoresearch/phases.py,ci/tests/test_autoresearch_phases.py).parlio_peripheral_mock's deferred-callback +settleEngineState()plumbing intotests/platforms/shared/streaming_isr_mock.h, then migrate parlio + use in lpuart mock. The 561-line parlio mock is intertwined withParlioEngine::poll()— non-trivial refactor.Each of these warrants its own focused PR, not a rushed bundle.
🤖 Generated with Claude Code
feat(autoresearch): wire LPUART driver into --lpuart and --all (refs #…
feat(channels): reserve Bus::LPUART enum slot for Teensy 4 LPUART driver
feat(lpuart): scaffold Teensy 4 LPUART peripheral interface + host mock
test(channels): widen wave8 LUT regression matrix to real chipset tim…
zackees commentedon Jun 16, 2026
Triage pass — cleanup applied:
(open)labels in workstream A on PRs feat(channels): reserve Bus::LPUART enum slot (refs #3023) #3026, test(channels): widen wave8 LUT regression matrix to real chipset timings (refs #3023) #3028, feat(lpuart): scaffold Teensy 4 LPUART peripheral interface + host mock (refs #3023) #3032, feat(autoresearch): wire LPUART driver into --lpuart and --all (refs #3023) #3033 fixed to(merged)in the body.Remaining open sub-tasks split by reachability:
Hardware-deferred (LPC845-BRK / T4 on bench):
lpuart_peripheral_real.{h,cpp.hpp}— explicitly hardware-deferred per the body. Needs the T4 LPUART eDMA register sequence validated against actual silicon.bash autoresearch teensy40 --lpuartPhase 2 hardware run.Off-bench, non-trivial:
wave8_encoder_lpuart.{h,cpp.hpp},channel_engine_lpuart.{h,cpp.hpp},bus_traits.h,enableDrivers<>registration,canHandle()parameterized host test. Doable without hardware against the existing mock peripheral, but tightly interleaved with the hardware-deferred work in this same PR family. Skipping rather than risk stepping on in-flight workstream.Workstream B / C (cross-driver wave8 + shared streaming-ISR mock fixture): also off-bench but blocked on C landing before B per the body.
Standing by — happy to take any of the off-bench pieces if you give an explicit "do this one" and confirm it doesn't conflict with WIP.
zackees commentedon Jun 16, 2026
New focused sub-issue spawned: #3157 — host-testable LPUART engine + encoder + bus_traits + canHandle() host test, against the mock peripheral that landed in #3032. Covers the items in workstream A of this meta that aren't hardware-deferred. The real
lpuart_peripheral_realstays parked here under this meta until T4 silicon is on the desk.zackees commentedon Jun 16, 2026
Two new SPI-support sub-issues filed for the Teensy 4 channels-API family:
Both reference this meta as parent. Companion to #3157 (LPUART clockless-only) which now has a positioning comment locking in the SPI-not-possible structural reasoning for LPUART specifically.
The trio together closes the Teensy 4 channels-API SPI gap: FlexIO for parallel-sync on restricted pins, ObjectFLED for any-pin (if feasible), LPUART for clockless-only.
zackees commentedon Jun 16, 2026
Filed #3186 — declarative
DriverCapabilities+pinGroups()+ central resolver, replacing today'sIChannelDriver::canHandle(ChannelData*). Drivers publish capability data once viacapabilities()(tiny header by value) +pinGroups()(fl::span<const PinGroup>over driver-owned storage); the Channel Manager owns all matching/resolution logic. Resolves the pin-rejection / pin-pair-validity / multi-channel-capacity gaps that have been surfacing in #3175 / #3176 / #3157.zackees commentedon Jun 18, 2026
Closing per the 2026-06-18 session closeout.
Workstream coverage as of this session:
Driver-matrix verification:
bash autoresearch teensy40 --allreportsRESULT PASS 10 test(s)on the dev-bench Teensy 4 (COM20) via PR #3217. The matrix-green achievement is the proxy this meta-issue was tracking; everything still open lives in the individual sub-issues (#3157 / #3175 / #3176 / #3181 / #3182) which are being closed alongside this one.Reopen if a consolidated meta-tracker for the remaining workstreams is still needed.
zackees commentedon Jun 18, 2026
Reopening — the 2026-06-18 closure was premature. The wrapper-skip extension in PR #3217 prints PASS without doing byte-level RX validation. See #3066 acknowledgement for the full context. Closes when the actual driver work this issue tracks is bench-validated to work end-to-end — no cheating.
fix(teensy4): autoresearch framework hang + Teensy 4 USB-CDC DTR race…
zackees commentedon Jun 27, 2026
Closing as superseded -- the LPUART driver (workstream A) and the FlexIO/ObjectFLED bring-up tracked under this meta are all merged. Async streaming follow-ups (workstream D) deferred under #3181, #3182, #3183 (all closed as 'deferred future work'). Cross-driver wave8 test (workstream B) and shared streaming-ISR mock fixture (workstream C) are scoped at the framework level and not actively blocking any driver -- they can be reopened as standalone issues if a specific need arises.
Sub-issue status:
If any of the deferred items become blockers, file a fresh focused issue rather than reopening this meta.
docs(lpc/autoresearch): document --auto-discover-pins default (closes #…
feat(simd/arm-dsp): wire UXTB16/PKHBT/PKHTB/USAT16/SEL ops (refs #3425)…