Repository navigation
Description
Why this issue exists
Split from the now-closed rundown meta #3122 row B1. The LPUART driver work tracked under meta #3023 has its real hardware-side driver (lpuart_peripheral_real) explicitly deferred — but the remaining off-bench pieces (engine + encoder + bus_traits + registration + host test) aren't tracked as a single focused PR-able unit anywhere. This issue fixes that.
Scope
Land the host-testable LPUART engine layer for Teensy 4 (iMXRT1062), against the mock peripheral that already shipped in #3032. The real iMXRT register driver stays hardware-deferred under #3023 — this issue is the layer that sits on top of whichever peripheral implementation runs.
Files
All under src/platforms/arm/teensy/teensy4_common/drivers/lpuart/ unless otherwise noted:
-
wave8_encoder_lpuart.{h,cpp.hpp}— packs aWave8Byteinto the 8 programmable UART data bits per frame (start/stop framing handled by the inverted hardware). Mirror the existingwave8_encoder_uart.{h,cpp.hpp}pattern from the ESP32 side. -
channel_engine_lpuart.{h,cpp.hpp}—IChannelDriversubclass. Syncshow()for this issue's phase 1; async path follows under [meta] Teensy 4 channels-API driver coverage + verification fixtures (supersedes #2764, #3006) #3023 §D. -
bus_traits.h—BusTraits<Bus::LPUART>mirroring the objectfled / flex_io patterns (Drivertypedef,instancePtr(),instance(),registerWithManager()at priority 3) plusBusSupports<Bus::LPUART, ClocklessChipset> : fl::true_type. -
_build.cpp.hpp— engine-side unity-build aggregator that pulls in the new TUs above. The mock-side_build.cpp.hppalready exists (feat(lpuart): scaffold Teensy 4 LPUART peripheral interface + host mock (refs #3023) #3032). -
src/platforms/arm/teensy/teensy4_common/init_channel_driver_mxrt1062.cpp.hpp— register the driver 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. -
tests/platforms/arm/teensy/teensy4_common/drivers/lpuart/channel_engine_lpuart.cpp— parameterized host test forcanHandle()against the mock peripheral. Asserts:- Accepts: WS2812, WS2812B, WS2812B-V5, SK6812, SK6812-RGBW.
- Rejects: APA102, SK9822 (clocked SPI), plus any chipset whose wave8 expansion violates the leading-HIGH/trailing-LOW topology.
canHandle() — wave8-generic, not chipset-specific
Same shape as the LPUART proposal in #3023 §A:
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
if (t.total_period_ns() < kLPUARTMinBitPeriodNs ||
t.total_period_ns() > kLPUARTMaxBitPeriodNs) return false;
// (2) Wave8 expansion must have leading HIGH and trailing LOW
auto lut = buildWave8ByteExpansionLUT(buildWave8ExpansionLUT(t));
if ((lut.lut[0x00].symbols[0].data & 0x80) == 0) return false;
if ((lut.lut[0xFF].symbols[7].data & 0x01) != 0) return false;
return mPeripheral->canHandlePin(static_cast<u8>(data->getPin()));
}Acceptance
-
bash compile teensy40 --examples AutoResearchsucceeds with the new engine wired in. - Host stub build still passes (engine TU gated by
FL_IS_TEENSY_4X). - The new
canHandle()parameterized test passes against the mock. -
ChannelManagerboot dump lists all four T4.x clockless options:BIT_BANG (pri 0), LPUART (pri 3), OBJECT_FLED (pri 5), FLEX_IO (pri 8). - Legacy
FastLED.addLeds<WS2812SERIAL, DATA_PIN, GRB>(...)template path remains functional (no regressions; no removal of the#define USE_WS2812SERIALgate on the legacy path).
Out of scope
lpuart_peripheral_real.{h,cpp.hpp}— the iMXRT register driver. Hardware-deferred under [meta] Teensy 4 channels-API driver coverage + verification fixtures (supersedes #2764, #3006) #3023 §A. This issue ships against the mock; the real driver is a separate PR once T4 silicon is on the desk for verification.- AutoResearch wiring — already shipped in feat(autoresearch): wire LPUART driver into --lpuart and --all (refs #3023) #3033 (
--lpuartflag +--allmapping). - Phase 3 async conversion — tracked under [meta] Teensy 4 channels-API driver coverage + verification fixtures (supersedes #2764, #3006) #3023 §D.
- Cross-driver wave8 byte-equivalence test — tracked under [meta] Teensy 4 channels-API driver coverage + verification fixtures (supersedes #2764, #3006) #3023 §B.
- Shared streaming-ISR mock fixture — tracked under [meta] Teensy 4 channels-API driver coverage + verification fixtures (supersedes #2764, #3006) #3023 §C.
Why this is a focused issue rather than rundown-row work
The original rundown meta #3122 B1 mis-scoped this as a single rundown-row commitment. Six files of C++ + a parameterized host test + integration with the existing channels registry + careful coexistence with the legacy WS2812SERIAL controller path is a 3-4 hour focused PR with real review surface, not a "go" / "skip" item. Pulling it into its own issue is the right scoping. See the closeout comment on #3122 for the full rundown context.
Cross-references
- Parent meta: [meta] Teensy 4 channels-API driver coverage + verification fixtures (supersedes #2764, #3006) #3023 (Teensy 4 channels-API driver coverage). This issue is the next concrete sub-issue under workstream A of that meta.
- Closed rundown that spawned this: [meta] Actionable-work rundown — all off-bench items from the 2026-06-15/16 meta walk #3122.
- Mock peripheral shipped in: feat(lpuart): scaffold Teensy 4 LPUART peripheral interface + host mock (refs #3023) #3032.
- AutoResearch wiring shipped in: feat(autoresearch): wire LPUART driver into --lpuart and --all (refs #3023) #3033.
- Bus enum slot reserved in: feat(channels): reserve Bus::LPUART enum slot (refs #3023) #3026.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Jun 16, 2026
Positioning clarification — LPUART is the clockless-only, memory-efficient backend
Per the discussion that prompted this issue's filing, locking in the LPUART positioning explicitly so future readers don't go down the wrong path:
What LPUART IS for on Teensy 4:
What LPUART is NOT for, and why it's structurally impossible:
LPUART cannot drive SPI/clocked chipsets (APA102, SK9822) — not as a missing feature but as a hardware-level non-starter:
These constraints belong in this issue's
canHandle()predicate design (predicate #2 — the wave8 topology check — is exactly the static enforcement of constraint #2 above).SPI support on Teensy 4 will land via FlexIO and ObjectFLED extensions, not via LPUART. Those are tracked as separate focused issues (linked below).
Cross-references for the next person picking this up:
wave8_encoder_uartpattern from ESP32 for cross-driver byte-equivalence testing per [meta] Teensy 4 channels-API driver coverage + verification fixtures (supersedes #2764, #3006) #3023 §B.zackees commentedon Jun 16, 2026
Companion SPI issues now filed:
feat(flexio): parallel synchronized SPI driver for APA102/SK9822 on Teensy 4. Parallel-sync SPI via 1 FlexIO timer + N data shifters. 7 parallel strips per FlexIO1/FlexIO3 instance.feat(objectfled): investigate SPI/clocked-LED support. Conditional on three upstream-architecture questions about ObjectFLED's timer + DMA model. Any-pin SPI if the investigation resolves favorably.This completes the Teensy 4 channels-API SPI landscape:
zackees commentedon Jun 16, 2026
Cross-reference: #3186 — declarative
DriverCapabilities+ central resolver. LPUART here will publish 8PinGroupentries, one per LPUART instance, each with a single TX pin indata_pinsandmax_concurrent=1. Resolver-side pin rejection becomesNoPin(pin not in the union of LPUART instance TX pins) rather than runtime drop.zackees commentedon Jun 18, 2026
Closing per the 2026-06-18 session closeout — see #3023 for the meta context.
What's covered:
TEST LPUART lanes=1 leds=100 PASS).What's deferred to a bench session:
lpuart_peripheral_real.{h,cpp.hpp}iMXRT register driver - explicitly hardware-deferred per the original issue scope.channel_engine_lpuart.{h,cpp.hpp}+wave8_encoder_lpuart.{h,cpp.hpp}+bus_traits.h+ host test - the full off-bench engine layer ships as a follow-up PR once the iMXRT register driver is on the desk for end-to-end verification.Reopen when picking the bench work back up.
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.
feat(autoresearch): enumerate registered drivers on DriverNotRegister…
zackees commentedon Jun 27, 2026
Closed by PR #3421 () -- all Phase 1 acceptance criteria met:
src/platforms/arm/teensy/teensy4_common/drivers/lpuart/lpuart_encoder.h(pure-function wave8 encoder, host-testable)IChannelDriversubclass with syncshow()BusTraits<Bus::LPUART>+BusTraits<Bus::UART>(cross-platform alias) +BusSupports<Bus::LPUART, ClocklessChipset>_build.cpp.hppaggregatorchannel_drivers_teensy.impl.hppviaenableDrivers<fl::Bus::UART>tests/platforms/arm/teensy/teensy4_common/drivers/lpuart/lpuart_encoder.cpp+ilpuart_peripheral.cppAsync streaming-ISR follow-up tracked separately under #3182.