Repository navigation
Description
Motivation
The LPC845-BRK bring-up is functionally complete on three transports — Serial.println, JSON-RPC echo, and the FastLED log pipeline (FL_WARN_LIT) all round-trip through bash autoresearch lpc845brk --upload-port COM10 (verified on real hardware in #3014). The next gate is closed-loop WS2812 validation: drive a known frame on one GPIO, capture it on a bridged GPIO via an RX channel, decode the timing, and confirm the bit pattern matches what the driver intended to send.
The pin-bridge probe (probePair RPC added in #3014) already identifies which two pins the user has shorted with a jumper. The natural test wiring is P0_10 ↔ P0_11 — both GPIO-capable, both on the LPC845-BRK header.
What blocks this today
| Component | Status |
|---|---|
| LPC8xx WS2812 TX driver | ✅ Exists — src/platforms/arm/lpc/clockless_arm_lpc.h (bit-banged via shared m0clockless.h); SCT+DMA variant in clockless_arm_lpc_pwm_dma.h behind FASTLED_LPC_PWM_DMA. |
| Bring-up sketch flash budget | ❌ 97% full (63 060 / 65 536 B after the probePair binding). Adding #include <FastLED.h> + FastLED.addLeds<WS2812, P, GRB>(leds, 1) costs 2–4 KB on this platform — does not fit. |
LPC8xx RxDevice implementation |
❌ Does not exist. The current RxBackend enum only knows RMT (ESP32), ISR (ESP32-C6 MCPWM), FLEXPWM/FLEXIO (Teensy 4). Nothing for Cortex-M0+. |
| LPC845 RX hardware capability | ✅ SCT input-capture + DMA can timestamp edges at ~42 ns resolution (24 MHz SCT) — sufficient for WS2812 T0H/T1H discrimination (0.4 µs vs 0.8 µs). |
Why software-only RX won't work on LPC845
| Approach | Why it fails |
|---|---|
| GPIO ISR + software timestamp | Cortex-M0+ @ 24 MHz: ~16–46 cycles ISR latency (~1 µs). WS2812 T0H is 0.4 µs — every short-pulse edge gets missed. |
| Polled GPIO sampling | Achievable rate ~4–6 MHz, marginal vs the ≥ 3.2 MHz Nyquist on 0.4/0.8 µs pulses. Burns the CPU; no margin for ISR jitter. |
| SCT input-capture + DMA | The only viable path. |
Success criteria
The validation is complete when:
-
Flash margin restored on the bring-up sketch. The
fl::jsonfixed-point refactor tracked in fl::json: replace double with templated fixed-point variant to drop libgcc soft-FP bloat on embedded #3002 (and partially landed in perf(fl/math): gate libm behind SKETCH_HAS_LARGE_MEMORY; polynomial impls on Low-memory (closes most of #3002) #3012 / feat(lint): ban bare libm calls in src/; route power_mgt through fl:: #3013) frees enough flash thatexamples/AutoResearchLpc/AutoResearchLpc.inocan#include <FastLED.h>and add aWS2812controller alongside the existing JSON-RPC + watchdog + probe machinery — within the 64 KB-flash budget with ≥ 1 KB headroom. -
src/platforms/arm/lpc/rx_sct_capture.hships, implementing the FastLEDRxDeviceinterface against LPC845 SCT input-capture + DMA:- Register-level SCT setup: pick an input event (
EV_ntied to a CTIN/GPIO), program a capture register, route the event into the DMA-trigger mux. - DMA channel manages the capture buffer (edge timestamp + polarity per entry).
- WS2812 frame decoder: convert edge-timestamp stream → 24-bit GRB pixels by classifying each
T1-T0low-time against the T0H/T1H midpoint (0.6 µs nominal). - Plumbed through a new
RxBackend::LPC_SCT_CAPTUREenum + dispatch insrc/fl/channels/rx/channel.cpp.hpp::createBackendDevice. - Effort comparable to the existing
clockless_arm_lpc_pwm_dma.hTX driver (Stage 2c of meta: port FastLED to NXP LPC8xx (LPC804 + LPC845) — two-stage plan #2836) plus the decoder on top.
- Register-level SCT setup: pick an input event (
-
Loopback test passes via autoresearch. With both above, the LPC bring-up sketch adds:
CRGB leds[1]; FastLED.addLeds<WS2812, P0_10, GRB>(leds, 1); remote.bind("ws2812Loopback", [](int color) -> int { leds[0] = CRGB(color); FastLED.show(); auto rx = fl::RxChannel::create({P0_11, fl::RxBackend::LPC_SCT_CAPTURE}); auto frame = rx->capture(/*timeout_ms=*/10); return frame.equals(leds[0]) ? 1 : 0; });
and
bash autoresearch lpc845brksends{\"method\":\"ws2812Loopback\",\"params\":[0x010203],\"id\":1}and expectsresult:1— confirming the WS2812 driver emits valid frames that round-trip the LPC845's own capture peripheral. -
Pin-bridge auto-detect. The autoresearch harness should use the existing
probePairRPC to pick the loopback pin pair automatically (e.g., expect a bridge between two GPIO-capable pins not on the UART or SWD bus) rather than hard-coding P0_10/P0_11. The probe results in feat(lpc845): WWDT watchdog driver + FL_WARN_LIT enabled on Low-memory #3014 already give the building block.
Related
- meta: port FastLED to NXP LPC8xx (LPC804 + LPC845) — two-stage plan #2836 — LPC8xx port master tracker
- meta: LPC dev roadmap — Stages 3 + 4 (port completion, family expansion) #2845 — LPC clockless TX driver matrix
- fl::json: replace double with templated fixed-point variant to drop libgcc soft-FP bloat on embedded #3002 —
fl::mathlibm gate +fl::jsonfixed-point refactor (frees the flash) - AutoResearch: wire LPC845-BRK into bash autoresearch harness #3004 — AutoResearch: wire LPC845-BRK into bash autoresearch harness
- perf(fl/math): gate libm behind SKETCH_HAS_LARGE_MEMORY; polynomial impls on Low-memory (closes most of #3002) #3012 — libm-free
fl::math(merged) - feat(lint): ban bare libm calls in src/; route power_mgt through fl:: #3013 — bare libm linter + power_mgt
fl::powf(merged) - feat(lpc845): WWDT watchdog driver + FL_WARN_LIT enabled on Low-memory #3014 — LPC8xx WWDT driver +
FL_WARN_LITon Low-memory + pin-bridgeprobePair(open)
Session evidence
End-to-end verification of the existing three transports on real LPC845-BRK on COM10:
TX: {"jsonrpc":"2.0","method":"echo","params":[4242],"id":1}
RX: b'FL_WARN: echo invoked\r\nREMOTE: {"id":1,"result":4242,"jsonrpc":"2.0"}\r\n'
✅ Serial.println — REMOTE: response received
✅ JSON-RPC echo — sentinel 4242 round-trip verified
✅ FL_WARN_LIT — FastLED warn pipeline reached host
And the pin-bridge probe correctly identified the jumper:
Bidirectional hits: 1
P0_10 <-> P0_11
🤖 Filed via Claude Code during the LPC845 WS2812 bring-up attempt that hit the RX gate.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
feat(autoresearch/lpc): pre-charge + longer settle on probePair scan
feat(rx/lpc): scaffold LPC8xx SCT-capture RX backend + WS2812 decoder (…
feat(rx/lpc): SCT input-capture + pin-toggle loopback (refs #3021) (#…
feat(lpc): channels-API SCT+DMA clockless engine scaffold (#3459) (#3460
feat(autoresearch): LPC845 SPI+DMA async driver validation harness (#…