Skip to content

Default LPC845 AUTO to UART DMA - #3614

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

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

Conversation

@zackees

@zackees zackees commented Jul 6, 2026 •

Copy link
Copy Markdown
Member

Summary

  • default LPC845 clockless AUTO to the USART DMA channel engine with FASTLED_LPC_UART_DMA normalized to 1/0
  • enable the LPC DMA ISR hub by default when UART DMA is active so descriptor chaining works without extra user defines
  • allow the UART loopback RX pin to be any LPC845 movable USART pin while keeping DMA channel selection tied to the USART instance
  • keep AutoResearch's UART RPC harness opt-in via FASTLED_AUTORESEARCH_LPC_UART_DMA so the library default does not bloat normal LowMemory builds

References

Local verification

  • bash lint --cpp
  • bash test --cpp (350/350 passed earlier on this branch)
  • bash lint (passed earlier on this branch)
  • bash compile lpc845 --examples Blink
  • linker map contains ChannelEngineLpcUartDma and LpcUartDmaRuntime::{init,armNextChunk,onDmaChunkDone} in the plain Blink build
  • bash autoresearch lpc845 --uart --upload-port COM10 --no-auto-discover-pins --tx-pin 13 --rx-pin 11 --timeout 120s --skip-lint
    • PASS: probe step 0 1,entry
    • PASS: probe step 7 1,uart_rx_dma,0
    • PASS: 3 loopback payloads matched expected bytes (0xFF0000, 0x00FF00, 0x55AA33)

Summary by CodeRabbit

  • New Features

    • LPC845 now uses UART DMA as the default clockless bus path, with a clear fallback to bit-banged behavior when disabled.
    • UART DMA loopback testing now supports more flexible pin selection and improved pin labeling in logs.
  • Bug Fixes

    • Fixed cases where LPC845 UART DMA setup could fail when optional settings were unset.
    • Improved validation so only supported UART pins are accepted for DMA/loopback use.

Default LPC845 clockless AUTO to the USART DMA engine, normalize the FASTLED_LPC_UART_DMA macro to a 1/0 value, and keep the DMA ISR enabled by default for descriptor chaining.

Allow the UART loopback RX pin to move through the LPC845 switch matrix while keeping DMA request channels tied to the USART instance, per UM11029 Tables 181, 182, and 296.

Wire AutoResearch UART loopback through its own opt-in harness define so the library default does not bloat normal LowMemory builds.
@zackees
zackees merged commit 31891c4 into master Jul 6, 2026
10 of 11 checks passed
@zackees
zackees deleted the feat/lpc-uart-dma-auto-pins branch July 6, 2026 22:08
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jul 6, 2026
@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: 479866b0-8d12-46c6-9b80-99f4c67869ae

📥 Commits

Reviewing files that changed from the base of the PR and between c005e24 and eaae437.

📒 Files selected for processing (17)
  • ci/autoresearch/args.py
  • ci/autoresearch/phases.py
  • ci/autoresearch/test_lpc_uart_clockless.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/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/is_lpc.h
  • src/platforms/arm/lpc/uart_arm_lpc_dma.h

📝 Walkthrough

Walkthrough

Changes make FASTLED_LPC_UART_DMA default to enabled on LPC845, convert numerous preprocessor guards from defined()-checks to truthy-value checks, widen UART RX pin validation with a runtime movable-pin check, add SWM-based loopback RX routing, update AutoResearch example/CI build flags, add a pin-label helper, and update documentation.

Changes

LPC845 UART DMA Default Enablement

Layer / File(s) Summary
Default macro definitions
src/platforms/arm/lpc/is_lpc.h
Defines FASTLED_LPC_UART_DMA (default 1 on LPC845, else 0) and FASTLED_LPC_DMA_ISR when unset.
Truthy guard conversions
src/fl/channels/bus.h, src/fl/channels/bus_info.h, src/platforms/arm/lpc/channel_drivers_lpc.impl.hpp, src/platforms/arm/lpc/clockless_channel_lpc_uart_dma.h, src/platforms/arm/lpc/drivers/uart_dma/bus_traits.h, .../channel_engine_lpc_uart_dma.cpp.hpp, .../channel_engine_lpc_uart_dma.h, src/platforms/arm/lpc/fastled_arm_lpc.h
Preprocessor guards switch from defined(FASTLED_LPC_UART_DMA) to direct truthy evaluation, so a macro defined as 0 now correctly disables UART DMA paths.
Movable pin validation and loopback RX state
src/platforms/arm/lpc/uart_arm_lpc_dma.h, src/platforms/arm/lpc/drivers/uart_dma/_build.cpp.hpp, .../channel_engine_lpc_uart_dma.cpp.hpp
Adds isMovableUartPin, an optional RX pin argument to prepareLoopbackRxBuffer, a global loopback RX pin tracker, expanded pin bounds (up to 0x35) in canHandle, and a static assertion on the TX pin.
SWM TX/RX routing helpers
src/platforms/arm/lpc/uart_arm_lpc_dma.h
Adds hasLoopbackRxPin, loopbackRxPin, routeUart1Pins, routeUart2Pins to program SWM PINASSIGN registers, and ties LOOP mode enablement to loopback RX pin presence.
AutoResearch example harness gating
examples/AutoResearch/AutoResearchLowMemory.h, examples/AutoResearch/AutoResearchUartDma.h
Introduces FASTLED_AUTORESEARCH_LPC_UART_DMA flag, updates include/error/RPC-binding conditions, applies conditional macro defaulting, and expands rx_pin validation with movable-pin checks.
CI build flag wiring and pin labeling
ci/autoresearch/phases.py, ci/autoresearch/args.py, ci/autoresearch/test_lpc_uart_clockless.py
Emits FASTLED_AUTORESEARCH_LPC_UART_DMA=1 define for UART-DMA modes, guards argparse description against None, adds lpc_swm_pin_label helper for P0_/P1_ pin labeling, and updates a console message.
Documentation updates
src/platforms/arm/lpc/README.md
Documents LPC845 default USART-DMA clockless routing, the override flag, and expanded feature description.

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

Sequence Diagram(s)

sequenceDiagram
  participant App as Application init()
  participant Runtime as LpcUartDmaRuntime
  participant RouteFns as routeUart1Pins/routeUart2Pins
  participant SWM as SWM PINASSIGN registers
  participant USART as USART CFG register

  App->>Runtime: init()
  Runtime->>RouteFns: route TX pin
  RouteFns->>SWM: program TXD assignment
  Runtime->>Runtime: hasLoopbackRxPin()
  alt loopback RX pin configured
    Runtime->>RouteFns: route RX pin
    RouteFns->>SWM: program RXD assignment
    Runtime->>USART: disable LOOP mode
  else no loopback RX pin
    Runtime->>USART: enable LOOP mode
  end
Loading

Possibly related issues

✨ 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-auto-pins

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.

eelstretching pushed a commit to eelstretching/FastLED-pico that referenced this pull request Jul 11, 2026
Default LPC845 clockless AUTO to the USART DMA engine, normalize the FASTLED_LPC_UART_DMA macro to a 1/0 value, and keep the DMA ISR enabled by default for descriptor chaining.

Allow the UART loopback RX pin to move through the LPC845 switch matrix while keeping DMA request channels tied to the USART instance, per UM11029 Tables 181, 182, and 296.

Wire AutoResearch UART loopback through its own opt-in harness define so the library default does not bloat normal LowMemory builds.
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