Repository navigation
Description
Symptom
On LPC845-BRK with the AutoResearch low-memory firmware (flash 53.61 KB / 64 KB = 83.8%, RAM 9.03 KB / 16 KB = 56.4%), the bring-up phase observes:
- Build + flash + reset succeed (pyOCD CMSIS-DAP).
- Device boots and emits log lines back over USB-VCOM (we see
src/fl/remote/remote.cpp.hpp(151): INFO: Stored request ID for rpc.discover). rpc.discoverreturns a schema response (malformed under current pydantic model but data IS present -- list-of-lists with method names like'testSimd').echoRPC request returns empty:TX: {"jsonrpc":"2.0","method":"echo","params":[4242],"id":1}→RX: b''.- Phase fails:
BRING-UP TEST FAILED echo_ok=False remote_ok=False warn_ok=False log_ok=False.
This is a blocker for the #3102 bench-validation pass. Two of four validation phases (build/flash/reset and link-symbol soft-FP check) are green; the bring-up echo silence prevents validating the USB-VCOM RPC round-trip and gates the SCT-RX phases.
What we've already ruled out
-
Method not registered.
echoIS bound inexamples/AutoResearch/AutoResearchLowMemory.h:158(remote.bind("echo", [](int v) -> int { ... return v; })). The dispatcher also explicitly handles missing-method with-32601 "Method not found"+FL_WARN_Flog atsrc/fl/remote/rpc/rpc.cpp.hpp:121. Silence (not an error response) means the request never reached the dispatcher. -
Jumper interference. The LPC845-BRK USB-VCOM bridge is hardwired to P0_25 (U0_TXD) / P0_24 (U0_RXD) (per
variants/lpc845/variant.h). The autoresearch default loopback jumper is P0_10 → P0_11 -- general-purpose GPIO, not USART pins. Confirmed jumper-on-loopback-pins cannot break host↔device USART. -
Wrong COM port. Confirmed COM20 IS the LPC845-BRK USB-VCOM port (NOT COM25, which is an unrelated ESP32-P4). Discovery responses come back on COM20, proving the path is alive.
Hypothesis (per user instinct)
"in the past the chip not responding means it's crashed"
A HardFault inside the dispatcher (during JSON parse, request-source buffering, or the lambda invocation) would manifest exactly as the observed silence: the request enters but no response comes back, and there's no error report because the fault handler doesn't talk on the USART. Likely candidates on the 64-KB-flash / 16-KB-RAM LPC845 LowMemory build:
- JSON parse stack overflow --
fl::json::parsemay allocate deeply on a single LowMemory parse, and the parser sub-trees plus the lambda invoker stack frame may exceed the small stack budget. fl::function<>lambda invocation via the new Phase-1 RuntimeRpcBinding path (FastLED perf(rpc): non-template RuntimeRpcBinding dispatch on low-memory (#3246 Tier 1A) #3258, just merged). The runtime dispatcher chains an extra indirect call layer and may have an alignment/calling-convention issue specific to LowMemory targets.- chunked-deque allocator pressure -- FastLED refactor(math): move JSON soft-FP bit-codec into fl/math/ + fl::number scaffold #3294 just relocated the JSON soft-FP codec and adjusted the
as_float/as_doubleextraction path; an unintended heap-fragmentation regression on LowMemory could starve the response serializer.
Acceptance criteria
Multi-step. Each step is its own commit / mini-PR so we can localize the failure.
-
Step A: Autoresearch silence-detection feedback. When the bring-up phase sees no response within the configured RPC timeout, autoresearch must emit a stderr message like:
[ERROR] RPC not responding after <N>s. Most likely the device crashed. Suggested next steps: power-cycle the board, attach a debugger, or sprinkle FL_WARN at suspected fault sites to narrow down.Today silence is reported only as a quiet
echo_ok=False; that's interpreted by future agents (and humans) as "weird response" instead of "the firmware crashed and stopped talking." This is the user-requested improvement to the harness's stderr stream. Out of scope: the actual crash dump / debugger attach (separate issue). -
Step B: AutoResearch-low-memory feature flags /
#ifdefskinny mode. Add a build flag, e.g.FASTLED_AUTORESEARCH_BARE_BRINGUP, that strips the LowMemory sketch down to just theechoRPC method plus the FL_WARN literal smoke test -- nothing else (no SCT-RX, notestSimd, no IEEE754 codec test, no pinToggleRx, no ws2812SctTest). If this strip-down build'sechoworks, the bug is in one of the optional methods' init / registration path (stack budget, init-order, static-ctor heap thrash). If it still fails, the bug is in the core RPC / serial-source path itself.Suggested sub-steps:
- B.1: Add the
#ifdefskeleton; default to current (everything-enabled) behavior. - B.2: Strip-down build: only
echoregistered, all otherremote.bind(...)calls and their backing classes excluded via#ifndef FASTLED_AUTORESEARCH_BARE_BRINGUP. - B.3: Run
bash autoresearch lpc845brk -DFASTLED_AUTORESEARCH_BARE_BRINGUP=1(or however the flag is propagated -- seebuild_flagsin board ini). If echo works in skinny mode, bisect by re-enabling chunks until it breaks.
- B.1: Add the
-
Step C: Test simplest-possible RPC echo isolation. A minimum-viable
examples/AutoResearchEchoOnly/(NOT a new persistent example -- guarded by theFL_AGENT_ALLOW_NEW_EXAMPLEdirective ONLY for this bisection session, deleted on close) that contains nothing butSerial.begin+ oneremote.bind("echo", ...). If THIS sketch echoes correctly on LPC845, the problem is provably AutoResearch-side, not RPC-side. If it still fails, the problem is in the core JSON-RPC / serial-source plumbing under LowMemory. -
Step D: Sprinkle FL_WARN trace points in the request-source / dispatcher path. If steps B and C still leave the cause unclear, add
FL_WARN_LIT("trace: A")/("trace: B")markers at:createSerialRequestSourceimmediately after a byte enters the buffer- The point where the JSON parser completes for one request
- The dispatcher's entry point (before method lookup)
- The point where the response sink writes back to USART
The trace markers will let us see how far into the pipeline the echo request gets. Last trace seen → fault is between that one and the next.
-
Step E: Fix the actual cause. Once steps A-D localize, file the fix as its own PR with a regression test.
Out of scope
- Hardware-level USB-VCOM bridge or LPC11U35 firmware investigation -- the bridge is known-good (discovery messages come back).
- Schema validation pydantic compatibility (separate issue -- the
rpc.discoverresponse format vs. the host-sideRpcSchemamodel is a separate bug). - New persistent example sketches in
examples/-- step C'sAutoResearchEchoOnlyis bisection-only and gets deleted on close.
Refs
- Blocks meta(lpc845-brk): bench-validate the three on-hand-hardware checklists (deploy + #565-sidestep + SCT-RX phases) #3102 (LPC845-BRK bench-validation meta) -- 2/4 phases pass; bring-up + SCT-RX phases gated on this.
- Possibly regressed by perf(rpc): non-template RuntimeRpcBinding dispatch on low-memory (#3246 Tier 1A) #3258 (RuntimeRpcBinding for LowMemory) or refactor(math): move JSON soft-FP bit-codec into fl/math/ + fl::number scaffold #3294 (soft-FP codec relocation). If git-bisect-on-LPC-flash is feasible, that's the fastest first-cut.
- Related: the autoresearch stderr improvement in step A is a general harness enhancement; could be split into its own issue if step A lands separately.
Filed during /clud-fix burn-down on #3208 while attempting #3102 validation. Echo silence is the blocker; pinning the cause unblocks the remaining bench validation.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Jun 19, 2026
HIGH PRIORITY ADDITION — Step F: on-device crash detection + sync-flushed error emission
Order constraint: Step F MUST land after Step B (the
FASTLED_AUTORESEARCH_BARE_BRINGUP#ifdefstrip-down). The diagnostic code below needs a few hundred bytes of flash + ~64 B of RAM that the current full-fat AutoResearch build doesn't have headroom for. Once Step B carves out the slack, Step F's three traps fit comfortably and become permanent firmware-side instrumentation.Why this is high priority — root-cause smoking gun
Investigating the LPC's runtime stub turned up two latent silent-crash paths that match the observed echo silence exactly:
HardFault_Handleris a weak alias toDefault_Handler. From<fbuild-cache>/cores/lpc8xx/startup_lpc8xx.c:28:Default_Handleris the standard "infinite-loop forever" stub. A null-pointer deref, a stack overflow, an unaligned access, or any other Cortex-M0+ HardFault landed here means the chip silently spins until the next external reset. No serial output, no register dump, no nothing.operator newdoes not check for malloc failure. From<fbuild-cache>/cores/lpc8xx/lpc8xx_runtime.cpp:60-67:On the LPC845's 16 KB SRAM, a JSON-parse path with the chunked-deque allocator (FastLED [Container shape] fl::deque<T> should be chunked, not 2x-doubling vector-ring #3270 / refactor(math): move JSON soft-FP bit-codec into fl/math/ + fl::number scaffold #3294) can easily blow the heap.
operator newreturns null, the caller dereferences it, the resulting null-deref is a HardFault, the HardFault handler is the silentwhile(1)loop above. This is the exact path that produces the observedRX: b''.The combination is fatal for embedded diagnostics: every crash on this platform is silent by default.
Step F.1 — Override
HardFault_Handlerwith a sync-flushed emitterNew file
src/platforms/arm/lpc/fault_handler_lpc.cpp.hpp(gated onFL_IS_ARM_LPC_845/_804). Implements:Acceptance:
HardFault_Handleralias (strong symbol wins at link).fault_emit_*helpers do NOT allocate, do NOT callprintf, do NOT touch the C++ heap.NMI_Handlergets the same override (gated onFL_IS_ARM_LPC) -- same fault-emit + reboot path.Step F.2 -- Watchdog wiring + recovery-report on next boot
The LPC's WWDT support already exists at
src/platforms/arm/lpc/watchdog_lpc.impl.hpp-- a completeFastLED.watchdog()API withbegin(),feed(),lastResetCause(),consecutiveCrashCount(). AutoResearch doesn't currently use it.Wire it into
AutoResearchLowMemory.h::setup():Acceptance:
feed()called at the top of the autoresearch main loop.Step F.3 --
operator newOOM trap with sync emitDrop-in replacement for the LPC8xx core's
operator newchain so an OOM goes from "silent null deref -> HardFault -> infinite loop" to "FAULT: OOM size=N -> reboot."New header
src/platforms/arm/lpc/operator_new_oom_trap.cpp.hpp(LPC8xx-gated):The trap also covers
fl::vector/fl::shared_ptr/ chunked-deque allocations because they go throughoperator new/mResource->allocate()which uses the C heap on LPC.Acceptance:
operator new/operator new[]fromlpc8xx_runtime.cpp(link-time replacement -- our override wins because it's not weak).FAULT: OOM size=0x<hex>before reboot.AIRCR.SYSRESETREQreboot path as Step F.1 -- single shared exit point so the next-boot watchdog-cause detection (Step F.2) catches it as SOFTWARE.Combined safety net
After Step F.1 + F.2 + F.3 land, the silent-crash surface on LPC is gone:
Default_HandlerFAULT: HardFault PC=0x... LR=0x... xPSR=0x...then rebootRECOVERED FROM WATCHDOG RESEToperator newreturns null)FAULT: OOM size=0x<hex>then rebootCross-cuts to other platforms
Out of scope for THIS issue but worth tracking: ATmega / STM32 / RP2040 / ESP32 all have analogous silent-crash paths (no fault handler override + un-checked allocator). Step F's LPC implementation is the prototype; a follow-on meta should propagate it to every platform that ships a FastLED watchdog + has a no-FPU / tight-RAM tier where OOM matters. File that as a separate meta once Step F lands on LPC.
Why not just step-debug?
Could attach a debugger and step through the bring-up to find the actual fault site, and that's still the right move for the immediate echo investigation. But Step F is foundational: even after the current bug is fixed, future regressions on LPC (e.g. the next chunked-deque or RPC refactor that accidentally bumps RAM use over the budget) will silently hang again unless these traps are in place. Step F makes "silent crash" structurally impossible on LPC8xx.
Updated ordering: A (autoresearch stderr) -> B (
#ifdefskinny mode) -> C (echo-only isolation) -> D (FL_WARN trace) -> F (on-device crash detection) -> E (fix the localized cause). F lands after B because the diagnostic code needs the RAM headroom B carves out.fix(platforms/lpc): work around Serial.println silent-drop on LPC8xx (c…
zackees commentedon Jun 20, 2026
Debug session findings (post-PR #3314 / #3313 println fix)
After landing the LPC println fix (#3313 / PR #3314), the bring-up echo still returns empty RX. The println fix was a real bug -- but it's NOT what's keeping bring-up silent. Updated investigation summary below.
Empirical evidence
Hypotheses to test (in priority order)
USART0 isn't actually transmitting after `Serial.begin(115200)`. Possible causes: SWM pin assignment failed silently, USART clock not enabled, or the LPC845's main clock isn't at 24 MHz so the BRG divisor produces the wrong baud. Verify by toggling a known-good GPIO from setup() as a "device is alive" beacon -- if the LED toggles but USART stays silent, USART init is the bug.
Setup() crashes BEFORE Serial.begin() can complete. The HardFault override from fix(startup): override HardFault_Handler with sync-emit + reboot (closes #30) framework-arduino-lpc8xx#31 IS linked in the firmware (verified via `arm-none-eabi-nm`: HardFault_Handler at 0x2aa0, distinct from Default_Handler at 0x2a50). But if the fault is in the FaultHandler's own emit path -- e.g. USART0 init is what crashed -- the override hangs trying to emit and silence prevails. Verify by adding a direct `LPC8XX_USART0->TXDAT = 'X'` poke as the first instruction of setup, before `Serial.begin`, to prove the chip is at least running.
WDT armed at 3 s in setup but setup never returns -- WDT fires, resets chip, and the cycle repeats. Boot-loop scenario. Check by reading SYSRSTSTAT after a manual reset and watching it report `WATCHDOG` cause repeatedly.
The LPC11U35 USB-VCOM bridge isn't actually wired to LPC845's USART0 TX/RX on this board. Unlikely (per the BRK schematic), but verify with an oscilloscope on P0_25 TX during boot.
What this means for the meta goal
Per the /clud-fix session goal -- "auto research can prove that json rpc in bad memory mode test can emit an error, else file an issue and then you are done" -- I cannot establish basic device communication right now, so the autoresearch can't prove anything. This issue (#3300) remains the open blocker.
The println fix (PR #3314) is a real bug that needed fixing, and the user's diagnostic instinct ("our io printf in fastled is not correctly binding to the LPC print function") pointed at it directly. But it's not THE bug keeping bring-up silent.
Suggested next session
This session's contributions to #3300:
I'm logging off this session with the diagnostic plumbing in place but the underlying USART silence un-rooted-out.
/clud-fix session continued from #3208 meta.
zackees commentedon Jun 20, 2026
Correction to my previous comment
Re-reading my own evidence, I was wrong to say `Serial.print` works. The only "Serial.print works" datapoint I had was autoresearch's schema-validator output line `[debug] Line 1: src/fl/remote/remote.cpp.hpp(151): INFO: Stored request ID for rpc.discover`. I then confirmed that string is NOT in the current firmware's `.rodata` (`arm-none-eabi-strings firmware.elf | grep "Stored request"` -> empty), so it can't be from the current device. It was stale serial-buffer data from an earlier firmware version that ran before being overwritten.
Actual truthful state
After autoresearch flashes + pyocd resets, direct serial open of COM20 from PowerShell returns 0 bytes in 6 seconds. No boot output. No reset banner. No FL_WARN. No FAULT emit (the HardFault override would emit on any crash; we see nothing). No echo response when I write a JSON-RPC request directly.
Nothing reaches COM20 on the current firmware. The USART is fully silent.
This means:
Updated hypothesis ranking (most -> least likely)
Next concrete diagnostic
Toggle `P0_18` (on-board user LED) from setup() BEFORE `fl::serial_begin()`. Code sketch:
```cpp
// First instruction in autoResearchLowMemorySetup, before Serial.begin:
pinMode(18, OUTPUT);
for (int i = 0; i < 6; i++) {
digitalWrite(18, HIGH); delay(100);
digitalWrite(18, LOW); delay(100);
}
fl::serial_begin(115200); // existing
// ... rest of setup
```
If LED blinks 6 times on power-up:
If LED does NOT blink:
I'm out of session budget; leaving the diagnostic at the door for the next agent.
/clud-fix session
fix(autoresearch/lpc): assert DTR=True + VID:PID port detection (#3300)…
feat(serial): board fingerprints + `fbuild serial probe` CLI (#686) (#…
docs(serial): USB CDC DTR/RTS control-line semantics matrix (#689) (#701
feat(serial): BoardFamily reset_method + dispatch_reset (#687) (#703)
feat(cli): fbuild bringup orchestrator scaffold (#697) (#711)
zackees commentedon Jun 23, 2026
Tracking this under the new LPC845-BRK / LPC8xx AutoResearch coordination meta: #3348.
Keeping this issue open as the current bring-up blocker. #3348 should not close until this echo/RX path is fixed, superseded by a narrower blocker, or explicitly deferred with hardware evidence.
zackees commentedon Jun 30, 2026
Toolchain-side context for the echo-silence investigation: the build path to even reproduce on master is currently broken on fbuild 2.3.14 due to two issues independent of #3300 — see #3450. fbuild PR FastLED/fbuild#900 fixes the platform matcher; the framework tarball checksum still needs an upstream fix. Once both land, this issue's hardware hypotheses (USART0 clock / SWM / setup() crash) can be tested again without a build detour.
feat(channels): add LPC DefaultBus<> specializations (#3450 B4) (#3451)
feat(lpc): LPC845 SPI + DMA0 async driver — Phase 1 of #3453 (#3454)
feat(lpc): channels-API SCT+DMA clockless engine scaffold (#3459) (#3460
feat(lpc): AutoResearch PWM+DMA clockless harness + TX→RX readback (#…
feat(autoresearch): accept LPC-Link2 CMSIS-DAP VID:PID for LPC845-BRK (…
feat(lpc): drive SCT+DMA chunk progression via poll() — no busy-wait (#…
fix(lpc): WWDT actually arms now (MOD/TC swap) + NMI wedge backtrace …
zackees commentedon Jul 6, 2026
Rolled up under the active LPC845-BRK meta #3348 and attached there as a GitHub sub-issue.
Next agent: re-test this locally on the attached LPC845-BRK, not from stale comments. Include the exact
bash autoresearch ...command, serial port, jumper wiring, and observed RPC responses before closing this issue.zackees commentedon Jul 6, 2026
Validated fixed on current
origin/masterwith the attached LPC845-BRK on COM10.Command:
Local hardware result:
lpc845AutoResearch.{jsonrpc:2.0,method:echo,params:[4242],id:1}FL_WARN: echo invokedREMOTE: {id:1,result:4242,jsonrpc:2.0}BRING-UP TEST PASSED.No jumper is required for this bring-up echo/RPC check. This validates the stale empty-RX failure is no longer present on the attached board.
Related recent merged PR evidence for the current master baseline: #3614.