Skip to content

feat(lpc): widen spi_arm_lpc_dma.h gate to include LPC804 (#3499) - #3500

Merged
zackees merged 1 commit into
masterfrom
feat/lpc804-spi-dma-gate
Jul 1, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/lpc804-spi-dma-gate

Conversation

@zackees

@zackees zackees commented Jul 1, 2026 •

Copy link
Copy Markdown
Member

Summary

FastLED-side companion to the two upstream PRs that landed the LPC804 vendor CMSIS PAL prerequisite:

Changes

  • Widen the gate from `FL_IS_ARM_LPC_845` to `(FL_IS_ARM_LPC_845 || FL_IS_ARM_LPC_804)`.
  • Per-chip `FASTLED_LPC_SPI_DMA_CHANNEL` default:
    • LPC845: 4 (SPI0_TX per UM11029 Table 80). Unchanged.
    • LPC804: 0 (SPI0_TX per UM11065 §12.4 DMA trigger source table).
  • Clear `#error` diagnostic if a user opts into `FASTLED_LPC_SPI_DMA` on LPC804 while the toolchain is still on the pre-Add basic XY matrix support #35 vendor PAL — points at the fbuild release requirement rather than cascading into a wall of `'DMA0' was not declared` errors.
  • Update class + file docstring to reflect dual-chip support.

Compile matrix

  • `bash compile lpc804 --examples Blink` → ✅ succeeds (default, no SPI DMA opt-in, unaffected by the gate widening).
  • `bash compile lpc845 --examples AutoResearch --defines "FASTLED_LPC_SPI_DMA=1"` → ✅ succeeds.
  • `bash compile lpc804 --examples Blink --defines "FASTLED_LPC_SPI_DMA=1"` → ❌ fails with the new #error until fbuild ships a release with Convert rand multiplication constants to shifts and adds. #916. Expected — the diagnostic message tells the user exactly what they need.

Host tests

`bash test --cpp` → 344/344 passed. C++ lint → clean.

Refs

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Expanded SPI DMA support to include LPC804 alongside LPC845 under the same opt-in build setting.
    • Added chip-specific default DMA channel selection so each supported device uses the expected SPI transmit channel.
  • Bug Fixes

    • Added a build-time safeguard for LPC804 when required DMA support is unavailable, helping prevent unsupported configurations.

FastLED-side companion to FastLED/framework-arduino-lpc8xx#35 (adds
`DMA_Type` + `DMA0` to LPC804's vendor CMSIS PAL, merged as
`1179200a30`) and FastLED/fbuild#916 (bumps `ACLPC_COMMIT` to that
SHA, merged as `f43acc3d82`).

## Changes

- Widen gate from `FL_IS_ARM_LPC_845` to
  `(FL_IS_ARM_LPC_845 || FL_IS_ARM_LPC_804)`.
- Add per-chip `FASTLED_LPC_SPI_DMA_CHANNEL` default:
    - LPC845: 4 (SPI0_TX per UM11029 Table 80) — unchanged.
    - LPC804: 0 (SPI0_TX per UM11065 §12.4 DMA trigger source table).
- Clear `#error` diagnostic if a user opts into `FASTLED_LPC_SPI_DMA`
  on LPC804 while the toolchain is still on the pre-#35 vendor PAL —
  points at the fbuild release requirement rather than cascading into
  a wall of `'DMA0' was not declared` errors.
- Update class + file docstring to reflect dual-chip support.

## Compile matrix

- `bash compile lpc804 --examples Blink` → ✅ succeeds (default, no
  SPI DMA opt-in, unaffected by the gate widening).
- `bash compile lpc845 --examples AutoResearch --defines
  "FASTLED_LPC_SPI_DMA=1"` → ✅ succeeds.
- `bash compile lpc804 --examples Blink --defines
  "FASTLED_LPC_SPI_DMA=1"` → ❌ fails with the new #error until a
  fbuild release picks up #916. Expected — the diagnostic message
  tells the user exactly what they need.

## Host tests

`bash test --cpp` → 344/344 passed. C++ lint → clean.

## Closes/refs

- Closes the FastLED-side scope of #3499 (LPC804 vendor-header
  prereq). The remaining acceptance criterion — "Compile LPC804 with
  `-DFASTLED_LPC_SPI_DMA=1` succeeds" — flips green automatically the
  moment fbuild ships a release with #916.
- Refs #3453 Phase 1 (LPC async DMA drivers meta) and #2845 Stage 4
  (LPC family expansion).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees merged commit 0955847 into master Jul 1, 2026
6 of 8 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jul 1, 2026
@coderabbitai

coderabbitai Bot commented Jul 1, 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: f134e84a-d4c1-48cc-adb2-2bec8a0d9f56

📥 Commits

Reviewing files that changed from the base of the PR and between 8a4643e and da64c1e.

📒 Files selected for processing (1)
  • src/platforms/arm/lpc/spi_arm_lpc_dma.h

📝 Walkthrough

Walkthrough

The LPC SPI+DMA driver header is updated to support LPC804 in addition to LPC845 under the FASTLED_LPC_SPI_DMA flag. Documentation, compile-time gating, and default DMA channel selection are made chip-specific, with an LPC804 DMA0 compile-time check added.

Changes

LPC804 DMA Driver Extension

Layer / File(s) Summary
Documentation updates
src/platforms/arm/lpc/spi_arm_lpc_dma.h
Header title, supported-chip description, and build-time opt-in/resource notes are revised to cover LPC804 alongside LPC845, including chip-specific DMA channel availability.
Compile gating and default channel
src/platforms/arm/lpc/spi_arm_lpc_dma.h
Preprocessor guard now accepts LPC804 or LPC845, adds a compile-time error if DMA0 is undeclared on LPC804, and sets a chip-specific default for FASTLED_LPC_SPI_DMA_CHANNEL (0 on LPC804, 4 on LPC845).

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#3454: Prior PR that introduced the same LPC845 DMA0 build gating and default channel macro logic later extended here to LPC804.
✨ 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/lpc804-spi-dma-gate

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.

@zackees
zackees deleted the feat/lpc804-spi-dma-gate branch July 1, 2026 10:32
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jul 1, 2026
zackees added a commit that referenced this pull request Jul 1, 2026
…ers (#3502)

- Fix stale LPC845 clock reference (30 MHz -> actual 24 MHz FRO direct path per
  led_sysdefs_arm_lpc.h:49).
- Add newly shipped drivers to the Supported Platforms table:
  - LPC845 SCT+DMA channels-API engine (#3460, TX->RX byte-match verified #3472)
  - LPC845 SPI+DMA async driver (#3454)
  - LPC804 SPI+DMA async gate (#3500, requires fbuild >= 2.3.16 for LPC804
    CMSIS DMA0 typedef from framework-arduino-lpc8xx#35 + fbuild#916)
- Document new files under Files: spi_arm_lpc_dma.h, drivers/sct_dma/*,
  rx_sct_capture.{h,cpp.hpp}.
- Document new opt-in feature defines: FASTLED_LPC_SPI_DMA,
  FASTLED_LPC_SPI_DMA_CHANNEL, FASTLED_LPC_SPI_DMA_MAX_BYTES.
- Add recent shipped PRs (#3438 register-map remediation, #3454, #3460, #3472,
  #3500) and cross-repo prerequisites (framework-arduino-lpc8xx#35, fbuild#916).
- Add open follow-ups #3437 (register-map meta), #3501 (LPC11Uxx/LPC15xx SPI),
  fbuild#565 (CMSIS-DAP deploy).

No code changes.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
zackees added a commit that referenced this pull request Jul 1, 2026
…-up) (#3505)

The underlying driver `spi_arm_lpc_dma.h` was widened to LPC804 in #3500
once fbuild >= 2.3.16 ships the vendor DMA0 typedef, but the AutoResearch
harness gate stayed LPC845-only — so LPC804 users can never exercise the
`dmaSpi*` RPCs even with `FASTLED_LPC_SPI_DMA=1` set.

Changes:

- Widen `AutoResearchSpiDma.h` self-gate from `FL_IS_ARM_LPC_845` to
  `(FL_IS_ARM_LPC_845 || FL_IS_ARM_LPC_804)`. Header comments now note
  the F_CPU delta (24 MHz vs 15 MHz → default divider 6 yields 4 MHz vs
  2.5 MHz SCK).
- Widen `AutoResearchLowMemory.h` include + bind gates to match. The
  compile-time mutex against `FASTLED_LPC_PWM_DMA` stays LPC845-only
  (LPC804 has no PWM+DMA clockless driver), so the LPC804 path never
  triggers the collision.
- Add `LPC_DMA_SPI_ENVS = LPC_WS2812_ENVS | {"lpcxpresso804"}` in
  `ci/autoresearch/phases.py` and switch the phase gate + error message
  to use it.
- Pass `--core-hz` to `test_lpc_dma_spi.py` based on the target
  environment (15_000_000 for lpcxpresso804, else 24_000_000) so the SCK
  measurement band is centered correctly on LPC804 too.
- Update `--dma-spi` `--help` text to note LPC804 support + the fbuild
  release prerequisite.

Verified: WASM AutoResearch compile clean, `bash lint` clean.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
zackees added a commit that referenced this pull request Jul 1, 2026
…3507)

Adds `agents/docs/peripheral-existence.md` requiring agents to verify any
`<Peripheral>_Type` typedef / `<Peripheral>_BASE` address is actually
present in BOTH the vendor CMSIS PAL header for the specific chip variant
AND the chip datasheet chapter before writing driver code against it. If
either source is absent, halt development and report on the driving issue;
do NOT fabricate the missing typedef in the vendor header repo to make the
build compile.

Cross-linked from:
- `agents/docs/register-maps.md` (pre-flight before shim tier decisions)
- `.claude/agents/platform-port-agent.md` (description + Step 5 + Key Rules)
- `.claude/skills/platform-port/SKILL.md` (LED Output Drivers section)
- `CLAUDE.md` "Read the Right File for Your Task" table row

Discoverable by grep for: DMA, async driver, phantom peripheral, peripheral
existence, vendor CMSIS, FSL_FEATURE_SOC.

Canonical anti-example is the four-PR LPC804 phantom-`DMA_Type` cascade
(framework-arduino-lpc8xx#35, fbuild#916, #3500, #3505) — LPC804 silicon
has no DMA peripheral; NXP's own `LPC804.h` has zero `DMA_Type` /
`DMA0_BASE` / `FSL_FEATURE_SOC_DMA_COUNT`, but an agent fabricated one at
reserved AHB slot `0x50008000` so downstream driver code would compile.
Doc includes copy-pasteable verification recipe (grep vendor CMSIS
header + features + drivers dir) plus a false-negative guard so
verification of absence is as rigorous as verification of presence.

Closes #3506.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
zackees added a commit that referenced this pull request Jul 1, 2026
…MA silicon (#3513)

Reverts the FastLED-side of the phantom LPC804 DMA cascade (PRs #3500 + #3505).
LPC804 silicon has no DMA peripheral. Empirical evidence:

- NXP's own `mcux-sdk/devices/LPC804/LPC804.h`: zero `DMA_Type` typedef,
  zero `DMA0_BASE` macro. Only `CRC_BASE = 0x50000000` in the 0x5000_xxxx
  AHB range; 0x50008000 is a reserved slot.
- `LPC804_features.h`: no `FSL_FEATURE_SOC_DMA_COUNT`. LPC845's file has
  `FSL_FEATURE_SOC_DMA_COUNT = 1` and `FSL_FEATURE_DMA_NUMBER_OF_CHANNELS
  = 25`.
- `devices/LPC804/drivers/`: no `fsl_inputmux_connections.h`. LPC845's
  driver dir has it (INPUTMUX exists to route peripheral requests to
  DMA channels — no DMA, no INPUTMUX).
- UM11065 has only 3 DMA references, all copy-paste leftovers in ADC /
  DAC / CAPT / I2C / SPI comment blocks referring to "DMA trigger
  flags" for a peripheral that does not exist on this die.

Diagnosis credit @phatpaul (#3499 comment 4855252061). The revert follows
the guardrail landed in #3506 / #3507 (`agents/docs/peripheral-existence.md`).

## Changes

- `src/platforms/arm/lpc/spi_arm_lpc_dma.h` — narrow build gate back to
  `FL_IS_ARM_LPC_845` only. Add a compile-time `#error` that fires with
  a clear "LPC804 has no DMA" diagnostic + link to peripheral-existence
  guardrail if a user tries to opt into `FASTLED_LPC_SPI_DMA` on LPC804.
  Delete the earlier "LPC804 vendor CMSIS PAL prerequisite" text and the
  LPC804-specific `FASTLED_LPC_SPI_DMA_CHANNEL` default (0 → dropped;
  the LPC845 default of 4 stands).
- `examples/AutoResearch/AutoResearchSpiDma.h` — narrow harness gate
  back to LPC845 only.
- `examples/AutoResearch/AutoResearchLowMemory.h` — narrow include +
  bind gates back to LPC845 only.
- `ci/autoresearch/phases.py` — collapse `LPC_DMA_SPI_ENVS` back to
  `LPC_WS2812_ENVS` (LPC845 environments only). Drop the
  `is_lpc804 → core_hz = 15_000_000` branch (always 24 MHz now).
- `ci/autoresearch/args.py` — update `--dma-spi` `--help` text: drop
  LPC804 mention + fbuild prerequisite; note LPC804 not supported.
- `src/platforms/arm/lpc/README.md` — LPC804 row now clearly documents
  "no DMA-async SPI" with citation to the guardrail. `spi_arm_lpc_dma.h`
  files entry marked LPC845-only. Feature-defines section corrected.
  References/Shipped entry for #3500 strikethrough-annotated with
  "REVERTED — see peripheral-existence.md."

Follow-up (out of scope for this PR):

- Revert `framework-arduino-lpc8xx#35` (the fabricated `DMA_Type` in
  `variants/lpc804/LPC804.h`).
- Revert or supersede `fbuild#916` (bumped ArduinoCore-LPC8xx pin for
  the fabricated typedef).
- Close FastLED #3499 as INVALID.

## Verification

- `bash compile wasm --examples AutoResearch` — clean
- `bash lint` — python_pipeline passes; cpp_linting fails only on the
  same pre-existing Rust-binary silent-fail this Windows environment
  has (unrelated to this diff; see #3510)

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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