Skip to content

fix(autoresearch): widen SPI+DMA harness gate to LPC804 (#3456 follow-up) - #3505

Merged
zackees merged 1 commit into
masterfrom
fix/lpc-spi-dma-harness-lpc804
Jul 1, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/lpc-spi-dma-harness-lpc804

Conversation

@zackees

@zackees zackees commented Jul 1, 2026 •

Copy link
Copy Markdown
Member

Summary

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.

Direct follow-up to #3503 (which landed the harness) and #3500 (which widened the driver gate).

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.

Test plan

  • bash compile wasm --examples AutoResearch — clean
  • bash lint — clean
  • bash autoresearch lpcxpresso804 --dma-spi — pending silicon + fbuild ≥ 2.3.16

Related

Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]

Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Expanded SPI+DMA AutoResearch support to include LPC804 boards alongside LPC845.
    • CLI help and test execution now reflect the broader LPC8xx coverage and adjust timing settings per target.
  • Bug Fixes

    • Updated platform checks and error messages so SPI+DMA validation matches the supported LPC845/LPC804 environments.
    • Improved target-specific configuration during test runs to use the correct core speed for each board.

…-up)

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
zackees merged commit 13f8eb1 into master Jul 1, 2026
7 of 10 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: b035752f-b78f-41dd-9be6-38965c6eb836

📥 Commits

Reviewing files that changed from the base of the PR and between 43ef4e7 and 908ecaf.

📒 Files selected for processing (4)
  • ci/autoresearch/args.py
  • ci/autoresearch/phases.py
  • examples/AutoResearch/AutoResearchLowMemory.h
  • examples/AutoResearch/AutoResearchSpiDma.h

📝 Walkthrough

Walkthrough

This PR extends the LPC845-only SPI+DMA AutoResearch harness to also support LPC804 boards. CLI help text, CI environment sets, and dispatch logic are updated to accept LPC804, with a per-board core clock (15 MHz vs 24 MHz) passed through to the test runner. Firmware compile-time guards in the example headers are widened accordingly.

Changes

LPC804 SPI+DMA Support

Layer / File(s) Summary
CI dispatch and help text updates
ci/autoresearch/args.py, ci/autoresearch/phases.py
Adds LPC_DMA_SPI_ENVS including lpcxpresso804, updates --dma-spi help text with LPC804 fbuild requirement, widens dispatcher validation and error messages, and computes/passes a per-board --core-hz (15 MHz for LPC804, 24 MHz otherwise) to the test subprocess.
Firmware compile-time gating for LPC804
examples/AutoResearch/AutoResearchLowMemory.h, examples/AutoResearch/AutoResearchSpiDma.h
Widens #if guards from FL_IS_ARM_LPC_845 to (FL_IS_ARM_LPC_845 || FL_IS_ARM_LPC_804) for enabling the SPI+DMA harness and binding autoresearch::dma_spi, keeps the LPC845-specific PWM/SPI DMA conflict #error unchanged, and updates header comments/#endif annotations.

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

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#3503: Extends the exact same LPC845 SPI+DMA bench to also support LPC804, updating the same phases.py/args.py/--core-hz and header gating.
  • FastLED/FastLED#3454: Builds on the earlier LPC845 DMA0 async SPI driver gated by the same FASTLED_LPC_SPI_DMA machinery this PR extends.
  • FastLED/FastLED#3041: Introduced the AutoResearchLowMemory harness and LPC bring-up surface that this PR extends 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 fix/lpc-spi-dma-harness-lpc804

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 fix/lpc-spi-dma-harness-lpc804 branch July 1, 2026 14:11
@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
…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