Skip to content

Add LPC845 UART DMA clockless default - #3612

Merged
zackees merged 1 commit into
masterfrom
feat/lpc-uart-dma-default
Jul 6, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/lpc-uart-dma-default

Conversation

@zackees

@zackees zackees commented Jul 6, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Adds an LPC845 Bus::UART clockless channel engine that encodes WS2812 bytes to UART symbols and streams them through USART TX DMA.
  • Makes LPC845 clockless AUTO/default routing resolve to UART DMA when FASTLED_LPC_UART_DMA=1, including the legacy FastLED.addLeds<WS2812, PIN, GRB>() adapter.
  • Adds AutoResearch --uart coverage that drives through the normal FastLED API and verifies the encoded bytes with USART RX-DMA on the configured RX pin.
  • Keeps the public bus as Bus::UART; USART instance selection remains hidden in the LPC driver.

Closes #3611.

Datasheet / docs used

Datasheet facts applied from UM11029: USART1 RX/TX use fixed DMA channels 2/3, USART2 RX/TX use fixed channels 4/5, SWM PINASSIGN routes USART TXD/RXD, USART CFG provides LOOP/RXPOL/TXPOL, and initial DMA descriptor word 0 is reserved while live transfer config is CHANNEL[n].XFERCFG.

Hardware verification

  • bash test --cpp
    • PASS: 350/350
  • bash autoresearch lpc845 --uart --upload-port COM10 --no-auto-discover-pins --tx-pin 13 --rx-pin 11 --timeout 120s --skip-lint
    • PASS: 0xFF0000, 0x00FF00, 0x55AA33; each returned 24 bytes match expected pattern
    • Build flags included FASTLED_LPC_UART_DMA=1, FASTLED_LPC_DMA_ISR=1, FL_LPC_UART_DMA_CLOCKLESS_TEST=1, FL_LPC_UART_DMA_LOOPBACK_TEST=1, FL_LPC_UART_DMA_CLOCKLESS_TX_PIN=13, FL_LPC_UART_DMA_CLOCKLESS_RX_PIN=11
    • Firmware size: Flash 63.41 KB / 64.00 KB, RAM 9.61 KB / 16.00 KB
  • bash autoresearch lpc845 --dma-uart --upload-port COM10 --no-auto-discover-pins --timeout 60s --skip-lint
    • PASS: uartDmaStreamOnce(2048, 0xA5) total 20508 us for 2048 bytes
    • PASS: uartDmaStreamOverlap(2048, 0x5A) total 20510 us, toggles=8455

Both AutoResearch runs emitted the existing PlatformIO pio platform show warning after the successful fbuild deploy/test path; exit code was 0.

Summary by CodeRabbit

  • New Features

    • Added LPC845 UART DMA clockless support for FastLED output, including a new UART-based path and automatic selection when enabled.
    • Added a new verification workflow for UART RX loopback testing on supported LPC boards.
  • Bug Fixes

    • Tightened LPC build selection so only one clockless DMA path is chosen at a time.
    • Improved compatibility and reporting for UART DMA device detection and channel selection.
  • Documentation

    • Updated help text and LPC platform docs with UART test instructions and setup guidance.

@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jul 6, 2026
@zackees
zackees merged commit 7f14d8e into master Jul 6, 2026
8 of 11 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jul 6, 2026
@coderabbitai

coderabbitai Bot commented Jul 6, 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: a8d1d1e2-7e42-44b2-b74a-ce161ee287ac

📥 Commits

Reviewing files that changed from the base of the PR and between 61b9d62 and ddd2d97.

📒 Files selected for processing (23)
  • CLAUDE.md
  • autoresearch
  • ci/autoresearch/args.py
  • ci/autoresearch/phases.py
  • ci/autoresearch/rpc_bench.py
  • ci/autoresearch/test_lpc_uart_clockless.py
  • ci/autoresearch/test_lpc_ws2812_loopback.py
  • examples/AutoResearch/AutoResearchLowMemory.h
  • examples/AutoResearch/AutoResearchUartDma.h
  • src/fl/channels/bus.h
  • src/fl/channels/bus_info.h
  • src/platforms/arm/lpc/README.md
  • src/platforms/arm/lpc/channel_drivers_lpc.impl.hpp
  • src/platforms/arm/lpc/clockless_channel_lpc_uart_dma.h
  • src/platforms/arm/lpc/drivers/_build.cpp.hpp
  • src/platforms/arm/lpc/drivers/sct_dma/bus_traits.h
  • src/platforms/arm/lpc/drivers/uart_dma/_build.cpp.hpp
  • src/platforms/arm/lpc/drivers/uart_dma/bus_traits.h
  • src/platforms/arm/lpc/drivers/uart_dma/channel_engine_lpc_uart_dma.cpp.hpp
  • src/platforms/arm/lpc/drivers/uart_dma/channel_engine_lpc_uart_dma.h
  • src/platforms/arm/lpc/fastled_arm_lpc.h
  • src/platforms/arm/lpc/uart_arm_lpc_dma.h
  • src/platforms/shared/bitbang/bus_traits.h

📝 Walkthrough

Walkthrough

This PR adds an LPC845 UART DMA clockless channel driver, making it the default AUTO clockless path when FASTLED_LPC_UART_DMA is enabled. It wires bus traits/routing, adds a UART DMA channel engine and runtime, an AutoResearch --uart loopback bench, RpcBench call_flat/reset_and_drain APIs, a firmware test harness, and docs.

Changes

LPC845 UART DMA clockless path

Layer / File(s) Summary
Bus routing and device info
src/fl/channels/bus.h, src/fl/channels/bus_info.h
DefaultBus/BusInstanceCount and DeviceInfoResolver route LPC845 clockless output to Bus::UART when FASTLED_LPC_UART_DMA is enabled.
UART DMA runtime and channel engine
src/platforms/arm/lpc/uart_arm_lpc_dma.h, src/platforms/arm/lpc/drivers/uart_dma/*
Adds LpcUartDmaRuntime for async chunked DMA streaming and ChannelEngineLpcUartDma implementing timing encoding (wave10 LUT), queueing, transmission, and polling.
ClocklessController and platform wiring
src/platforms/arm/lpc/clockless_channel_lpc_uart_dma.h, src/platforms/arm/lpc/fastled_arm_lpc.h, src/platforms/arm/lpc/channel_drivers_lpc.impl.hpp, src/platforms/arm/lpc/drivers/sct_dma/bus_traits.h, src/platforms/shared/bitbang/bus_traits.h, examples/AutoResearch/AutoResearchLowMemory.h
Adds the UART DMA ClocklessController/adapters, updates platform selection to avoid conflicting with PWM-DMA path, and tightens bit-bang/SCT-DMA specialization guards.
Device firmware test harness
examples/AutoResearch/AutoResearchUartDma.h
Adds clockless encoding/probe/self-loopback handlers and conditionally registers new RPC methods; removes static init-once guard.
RpcBench APIs
ci/autoresearch/rpc_bench.py, ci/autoresearch/test_lpc_ws2812_loopback.py
Adds call_flat(), centralizes _extract_result(), adds reset_and_drain(), migrates existing loopback script to call_flat.
AutoResearch CLI/phases and bench script
autoresearch, ci/autoresearch/args.py, ci/autoresearch/phases.py, ci/autoresearch/test_lpc_uart_clockless.py
Adds --uart CLI flag/help text, define injection, special-mode dispatch with mutual-exclusion checks, and a new RPC-driven validation script.
Documentation
CLAUDE.md, src/platforms/arm/lpc/README.md
Documents datasheet lookup preference and the new UART DMA verification workflow/feature flag.

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

Sequence Diagram(s)

sequenceDiagram
  participant ClocklessController
  participant ChannelEngineLpcUartDma
  participant LpcUartDmaRuntime
  ClocklessController->>ChannelEngineLpcUartDma: enqueue(channelData)
  ClocklessController->>ChannelEngineLpcUartDma: show()
  ChannelEngineLpcUartDma->>ChannelEngineLpcUartDma: beginTransmission (encode LUT bytes)
  ChannelEngineLpcUartDma->>LpcUartDmaRuntime: kickDmaStreamAsync(pin, baud)
  LpcUartDmaRuntime-->>ChannelEngineLpcUartDma: DMA chunk armed/chained via ISR
  ChannelEngineLpcUartDma->>ChannelEngineLpcUartDma: poll() checks streamDone
  ChannelEngineLpcUartDma-->>ClocklessController: DriverState READY
Loading
sequenceDiagram
  participant CLI as autoresearch --uart
  participant phases as phases.py
  participant bench as test_lpc_uart_clockless.py
  participant RpcBench
  participant Firmware as LPC845 firmware
  CLI->>phases: parse --uart, --tx-pin, --rx-pin
  phases->>phases: inject FASTLED_LPC_UART_DMA defines
  phases->>bench: uv run ci.autoresearch.test_lpc_uart_clockless
  bench->>RpcBench: call/call_flat(uartDmaClocklessProbe)
  RpcBench->>Firmware: JSON-RPC over serial
  Firmware-->>RpcBench: probe/loopback CSV result
  RpcBench-->>bench: parsed result
  bench-->>phases: exit code 0/1
Loading

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#3601: Shares the RpcBench/pyserial-ban migration in ci/autoresearch/rpc_bench.py and ci/autoresearch/phases.py that this PR builds on with call_flat() and the UART clockless loopback flow.
✨ 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/lpc-uart-dma-default

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.

feat(lpc845): make UART DMA the default AUTO clockless channel path

1 participant