Repository navigation
Description
Context
Follow-up to #3713 (RP2040 IM411 mic board fails USB enumeration). On 2026-07-21 the full software recovery plan from that issue was executed on the Windows bench host and every software-only path was exhausted:
- Elevated
pnputil /restart-deviceon the failed devnode: reported success, device re-enumerated (freshDEVPKEY_Device_LastArrivalDate), descriptor handshake failed again (problem code 43). - Elevated
Disable-PnpDevice→Enable-PnpDevice(3 s and 10 s power-down windows) +pnputil /scan-devices: same result. - 1200-baud touch /
picotool reboot: impossible — no live endpoint to talk to.
Decisive constraint: a root-hub port restart is a USB bus reset, not a power cycle — desktop root hubs never cut VBUS. A board whose firmware wedges before/during TinyUSB bring-up (or with a physical D+/D− fault) never re-runs its ROM bootloader, so no host software can ever recover it. Recovery now requires exactly one physical action (BOOTSEL-hold power cycle, cable swap test, or SWD probe attach).
This issue documents what the bench host needs so this never requires a human again — i.e. instructions for fully unattended deploy and unattended recovery of bricked boards.
Why unattended deploy fails today
| # | Blocker | Status on bench host |
|---|---|---|
| 1 | Admin elevation is interactive (UAC consent, ConsentPromptBehaviorAdmin=5) |
UAC consent was granted quickly during the 2026-07-21 session, but there is no guaranteed non-interactive elevation path; gsudo is not installed (contrary to #3713's env notes) |
| 2 | No true VBUS power-cycle capability | Board is on a root-hub port (Port_#0014); VBUS is always on |
| 3 | Software BOOTSEL entry needs a live USB endpoint | 1200-baud touch and picotool reboot -f -u both require CDC or picoboot interface — unavailable when descriptor-failed |
| 4 | No SWD debug probe attached | No USB-independent flash/reset path |
| 5 | picotool / openocd not installed |
No tooling for 3/4 even if hardware existed |
Instructions: one-time attended setup (~20 min), unattended forever after
A. Non-interactive elevation (pick one)
Option 1 — gsudo credential cache (simplest):
winget install gerardog.gsudo
gsudo config CacheDuration -1 # infinite cache for this logon session
gsudo cache on # one UAC consent, then silent elevationSecurity tradeoff: any process in the logon session can elevate silently while the cache is on. Acceptable for a dedicated LED bench machine; do not do this on a general workstation.
Option 2 — pre-authorized scheduled task (tighter scope):
As admin, register a task that runs only the devnode-restart helper with highest privileges, runnable on demand by the bench user:
schtasks /create /tn "FastLED\UsbDevnodeRestart" /rl HIGHEST /sc once /st 00:00 `
/tr "powershell -NoProfile -ExecutionPolicy Bypass -File C:\bench\usb_restart_elevated.ps1"Then any Medium-integrity agent triggers it with schtasks /run /tn "FastLED\UsbDevnodeRestart" — no UAC prompt, and the elevated surface is one fixed script instead of arbitrary commands.
B. True VBUS power-cycle (the only fix for a hard-bricked board over USB)
Put bench boards behind a per-port-power-switching (PPPS) hub supported by uhubctl (e.g. YKUSH, or a uhubctl-listed PPPS hub). Then:
uhubctl -l <hub-location> -p <port> -a cycle -d 3
actually drops VBUS for 3 s → RP2040 cold-boots → ROM bootloader runs → board enumerates (app or BOOTSEL) regardless of how badly the last firmware wedged. Alternative: a smart plug/relay on the board's power feed. This is the single highest-value item — with it, hypothesis discrimination in #3713 (firmware wedge vs. dead hardware) becomes a one-command experiment.
C. SWD path — flash with USB on the target completely dead
Attach a Raspberry Pi Debug Probe (CMSIS-DAP, ~$12) to the board's SWD pads, then:
winget install OpenOCD # or scoop install openocd
openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg `
-c "adapter speed 5000" -c "program firmware.elf verify reset exit"This halts the core, flashes, and resets with zero dependence on the target's USB. It is also the only path that can debug why the IM411 sketch bricks USB (halt + backtrace instead of guessing). Longer-term, an rp2040 probe-rs backend in fbuild deploy (like the existing LPC probe-rs path) would fold this into the standard flow — candidate for a FastLED/fbuild issue.
D. Install picotool (software BOOTSEL entry when an endpoint exists)
winget install RaspberryPiFoundation.picotool # or build from pico-sdk
picotool reboot -f -u # force app -> BOOTSEL via vendor interface, no CDC neededE. Firmware-side safeguards (prevent re-bricking on redeploy)
For the IM411 I2S mic sketch (and any bench sketch):
- Bring up USB before I2S/peripheral init —
Serial.begin()early, delay ~100 ms, then init I2S. The RP2040 (IM411 I2S MEMS mic board) fails USB enumeration — recover & flash in no-intervention mode #3713 failure signature (partial descriptor response) matches firmware hanging mid-TinyUSB-bring-up. - Enable the watchdog early (
rp2040.wdt_begin(4000)/watchdog_enable), and pet it inloop(). A wedge then becomes a reboot instead of a brick. - Boot-loop escape to BOOTSEL: count consecutive watchdog resets (
watchdog_caused_reboot()) in a flash/RTC scratch register; after N≥3, callrp2040.rebootToBootloader(). The board then parks itself in BOOTSEL where any host can reflash it — self-recovering firmware.
F. Unattended deploy + recovery flow (once A–D are in place)
Standard deploy (endpoint alive):
fbuild deploy .build\pio\rp2040 -e rp2040 --skip-build # handles 1200-baud touch + UF2Recovery escalation ladder (scriptable end-to-end, verified orchestration in the #3713 session — verdicts RECOVERED_AND_FLASHED / RECOVERED_CDC_ONLY / STILL_DEAD / ELEVATION_DECLINED):
- CDC present →
fbuild deploy(or 1200-baud touch → UF2 copy toRPI-RP2). - No CDC, picoboot present →
picotool reboot -f -u→ UF2 copy. - Descriptor-failed → elevated devnode restart (helper below) → re-check 1/2.
- Still descriptor-failed →
uhubctl -a cycle(true VBUS drop) → re-check 1/2. - Still dead → SWD:
openocd ... program firmware.elf verify reset exit. - Still dead → hardware fault (board/cable); flag for human, stop retrying.
Elevated devnode-restart helper (step 3; the exact script validated on 2026-07-21):
param(
[string]$InstanceId = 'USB\VID_0000&PID_0002\6&3AF0F9CE&0&14',
[string]$LogPath = "$PSScriptRoot\usb_restart_elevated.log"
)
$ErrorActionPreference = 'Continue'
$script:log = @()
function Log([string]$msg) { $script:log += ("[{0}] {1}" -f (Get-Date -Format 'HH:mm:ss'), $msg) }
Log "Target: $InstanceId"
pnputil /restart-device $InstanceId | ForEach-Object { Log $_ }
Start-Sleep -Seconds 4
$dev = Get-PnpDevice -InstanceId $InstanceId -ErrorAction SilentlyContinue
if ($dev -and $dev.Status -eq 'Error') {
try { Disable-PnpDevice -InstanceId $InstanceId -Confirm:$false -ErrorAction Stop; Log "Disabled OK" } catch { Log "Disable failed: $($_.Exception.Message)" }
Start-Sleep -Seconds 10
try { Enable-PnpDevice -InstanceId $InstanceId -Confirm:$false -ErrorAction Stop; Log "Enabled OK" } catch { Log "Enable failed: $($_.Exception.Message)" }
}
pnputil /scan-devices | ForEach-Object { Log $_ }
Start-Sleep -Seconds 8
$final = Get-PnpDevice -InstanceId $InstanceId -ErrorAction SilentlyContinue
if ($final) { Log ("Final status: {0}" -f $final.Status) } else { Log "Devnode gone (re-enumerated)" }
Get-PnpDevice -PresentOnly | Where-Object { $_.InstanceId -like 'USB\VID_2E8A*' } |
ForEach-Object { Log ("RP2040 present: {0} [{1}]" -f $_.Status, $_.InstanceId) }
$script:log | Set-Content -Path $LogPath -Encoding utf8Note: keep the helper scoped to the failing devnode. Do not restart the root hub — the wireless input receiver (VID_25A7) shares it on this host.
Acceptance criteria (host is "unattended-ready")
- Elevation works without a UAC prompt (gsudo cache or scheduled task) — verified by running the devnode-restart helper from a Medium-integrity shell with no human present.
- Bench RP2040 is behind a PPPS hub;
uhubctl -a cycleverifiably cold-boots it. - Debug Probe wired to SWD pads;
openocd ... programflashes with target USB dead. -
picotoolandopenocdinstalled and on PATH. - IM411 sketch rebuilt with watchdog + boot-loop-to-BOOTSEL escape before it is flashed again.
- The escalation ladder (F) runs end-to-end unattended and reports a machine-readable verdict.
Environment
Windows 10 Pro 19045, fbuild 2.5.2, usbipd-win (present, can't help — binding needs admin and a working descriptor), gsudo/picotool/openocd not installed. Known-good Blink UF2 at .build\pio\rp2040\.fbuild\build\release\firmware.uf2 (built 2026-07-21, arduino-pico 4.5.3, env rp2040).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriage
Activity
zackees commentedon Aug 20, 2026
Burn-down disposition: DEFERRED — software foundations landed, bench hardware setup incomplete
Several items in this July setup plan are now implemented, but the issue's host-level acceptance is not complete for the original RP2040/IM411 fixture.
What has landed since this issue was filed
fbuild deployexposes both RP deployment mechanisms explicitly: PICOBOOT/picotool is the default (--transport picotool) and mass-storage UF2 remains available via--transport uf2.fbuild deploy --adminpermits a narrowly-scoped, one-shot UAC-gated USB PnP recovery when the daemon returns a typed recoverable endpoint;--no-adminprints physical recovery guidance instead.reset_usb_boot()throughrebootIntoBootloader().What is still missing from #3714 acceptance
picotool,openocd, anduhubctlare not available as standalone PATH tools (fbuild's managed PICOBOOT deploy path is separate).VID_2E8A&PID_000A, serial5303284720C4641C) is currently absent; COM12 is phantom/not selectable. The healthy COM18 device is a different RP2350W.Resume when the original board is attached behind switchable VBUS and/or SWD. Validate each ladder stage with machine-readable results, then repeat the #3908-style no-replug deploy/watchdog soak on the RP2040 IM411 firmware. Until then this is a physical bench-provisioning project, not a bounded FastLED source fix.
zackees commentedon Sep 6, 2026
Item C's suggested follow-up is now filed: FastLED/fbuild#1423 — add an SWD/probe-rs deploy transport for RP.
Verified before filing, so the issue is grounded rather than speculative:
fbuild deploy --transportcurrently offers onlypicotool(PICOBOOT-primary, default) anduf2(mass-storage). Both require a live USB endpoint on the target, which is exactly what a board wedged before USB bring-up does not have.RP2040andRP2350in its built-in target registry.That covers the software half of this issue's acceptance list. The remaining items — the PPPS hub for a true VBUS cycle, the Debug Probe wired to SWD pads, non-interactive elevation, and
picotool/openocdon PATH — are physical bench setup and can't be done from an agent session.One correction to this issue's framing worth recording: it is scoped to a Windows bench (
Windows 10 Pro 19045,gsudo,schtasks,pnputil). The bench appears to have since moved to Linux — the ESP32-C6 peer this tree's issues name as COM9 is present here as/dev/ttyACM0(303A:1001, ser8C:BF:EA:CF:87:B4,health=healthy), while no2e8adevice is enumerated at all. So sections A and F (gsudo / scheduled task / PowerShell devnode-restart helper) are no longer the applicable form of the problem; the Linux equivalent is simplyuhubctlplus udev rules, which makes section B even more clearly the high-value item.Separately, the device-side half is now implemented in #4167: after N consecutive watchdog resets the board reboots into the bootloader on its own, so a looping board re-presents itself as flashable without a human. That handles firmware that still runs; fbuild#1423 handles firmware that does not.
Generated with Claude Code
https://claude.ai/code/session_01KkufoNxfnNRU9psT3R9F51
feat(wdt): add opt-in boot-loop escape to the bootloader (#3713) (#4167)
zackees commentedon Sep 8, 2026
Second data point for this issue's core thesis, from the Linux bench. This issue documents the Windows host; today the same class of failure occurred on the NixOS host with the attached ESP32-C6, and every software-only recovery path was exhausted there too. Recording it because it confirms the "no VBUS power cycle ⇒ no unattended recovery" conclusion is not Windows-specific.
What happened. A peer-OTA run (
bash autoresearch rp2350w --net-peer --ota --peer-environment esp32c6) reflashes the fixture as well as the DUT. The C6 came back unresponsive:Linux-side equivalents of this issue's blocker table:
sudo -n truereports "a password is required"; account is uid 10004-Port USB 2.0 Hub(3-1.3) behind aUSB2.1 Hub(3-1); no per-port power switching, anduhubctlis not installedpicotool,openocd,uhubctlall not installedWhat "wedged" looked like at the kernel level, which may be useful diagnostic detail for this issue:
/dev/serial/by-idlink were both present and fresh — enumeration was fine, so "the board disappeared" is the wrong mental model.open()returnedEBUSY(errno 16)./proc/*/fdscan found no process holding the fd — so it was the kernelcdc_acmside, not a leaked userspace handle. (fuser/lsofare not installed either; the/procscan is the available substitute.)fbuild daemon locksshowed no port locks and a FREE project lock, ruling out the build tool.Every root-only recovery handle was unavailable:
So on Linux, exactly as this issue concludes for Windows: a USB bus reset is not a power cycle, and without VBUS control or elevation there is no host-software path back.
How it resolved: the
EBUSYcleared on its own after roughly two minutes, after whichfbuild deployrestored the board (Chip type: ESP32-C6FH4 (QFN32),RESULT: RPC smoke PASS). That was luck, not a procedure — a firmware hang that does not release the endpoint would not have cleared.Two additions I would suggest for the setup instructions here:
uhubctl; the sysfsauthorizedtoggle is a weaker fallback and still needs root, so a udev rule granting the bench user write access to the specific device'sauthorized/unbindnodes would close the elevation gap without blanket sudo.I have flagged on #3956 that the peer-OTA run should not be repeated unattended until either the C6 has an escape armed or the PPPS hub tracked here is in place.
zackees commentedon Sep 9, 2026
Bench host has changed: it is now Linux, and most of this issue's plan does not apply as written
The instructions above were written for the Windows bench host (2026-07-21). The active bench is now Linux (NixOS), with an RP2350W and an ESP32-C6 attached and running unattended autoresearch. Re-surveying against the checklist:
Sections A and D are moot. There is no UAC, so the
gsudo/ scheduled-task elevation work (blocker #1) disappears entirely — the largest attended-setup item on the list.wingetlikewise does not apply.Tooling status (blocker #5) — still all missing:
uhubctlpicotoolopenocdlsusbTopology (blocker #2) — verified from sysfs:
2e8a:f00f) enumerates at1-1— a root-hub port on xHCI controller0000:02:00.0. This is the same unrecoverable topology the issue describes: a root hub, no VBUS switching.303a:1001) is at3-1.3.3, behind a Realtek0bda:5411hub.One thing worth testing before buying a PPPS hub. The kernel exposes a port-disable interface for the RP's own root-hub port:
On xHCI root hubs that implement the port-power bit, writing to this clears
PPand genuinely removes VBUS — it is one of the mechanismsuhubctldrives, and it would satisfy section B without additional hardware. Whether this controller actually drops VBUS rather than only disabling the port is hardware-specific and I have not tested it — doing so power-cycles the board mid-campaign, so it needs a deliberate window. Some RTS5411 units also support PPPS, which would cover the C6. Suggested next step: confirm with a scope or by observing whether a BOOTSEL-held board re-enumerates after adisablecycle.Section E.3 is already implemented for RP2350W. The watchdog boot-loop escape this issue asks for exists —
src/platforms/arm/rp/watchdog_rp.impl.hppdocuments and implementsrebootIntoBootloader()via the bootrom'sreset_usb_boot(), with the RP2350-specific handling ofwatchdog_caused_reboot()returning false (#4167/#4172). That is very likely why this bench has survived long unattended runs: a wedged RP parks itself where the host can reflash it. The ESP32-C6 has no equivalent escape, which makes it the more fragile of the two boards on this bench.So the remaining unattended-recovery gap on the current host is narrower than the original table: not elevation, not firmware self-recovery on the RP, but (a) confirming or providing a real VBUS cycle, and (b) an SWD path, for which section C's Raspberry Pi Debug Probe recommendation still stands.
zackees commentedon Sep 9, 2026
An unattended-deploy hazard just fired on this bench: tty node numbers are not stable
While running long unattended
--net-peercampaigns, the ESP32-C6 silently moved from/dev/ttyACM2to/dev/ttyACM1. It did not disappear — it stayed on the bus at3-1.3.3,303a:1001,health=healthy— it simply re-enumerated and the kernel handed it a different node number.Four consecutive unattended runs then died on:
The failure text says "port is busy or doesn't exist", which reads like a wedged or dead board. It was neither. Both boards were healthy the entire time.
Why this is worse than lost runs
--net-peerrequires both ports:and the only selector
bash autoresearchandfbuild deployexpose is-p/--port, i.e. the unstable node path. There is no serial-number selector in either.So every unattended script must hardcode a node path that the kernel is free to reassign. The benign outcome is what I hit — a failed deploy. The dangerous outcome is a renumber that swaps two boards, at which point a hardcoded path deploys one board's firmware onto the other. That is precisely the isolation property #3832 lists as an acceptance criterion ("Deploying to COM17 never touches COM9"), and node paths cannot guarantee it.
This is the same class of problem as the USB VID/PID registry work: identity must come from something stable, not from enumeration order. The USB serial is stable and already surfaced —
fbuild port scanprints it:Workaround in use now
My campaigns resolve the serial to a node immediately before each run, via sysfs:
with the loop aborting cleanly if either serial is absent, rather than deploying to whatever now holds the old path.
Suggested fix
Let
--upload-port/--peer-upload-port(andfbuild deploy -p) accept a USB serial as well as a node path, resolving it at use time. That makes unattended benches immune to renumbering and makes the #3832 isolation criterion enforceable by construction rather than by luck. Related: this bench is Linux now, so the Windows-specific sections of this issue no longer apply (noted in my earlier comment).zackees commentedon Sep 10, 2026
Four bench-host findings from a long unattended RP2350 session (Linux/NixOS host)
This issue's existing material is Windows-specific. Adding what a Linux bench turned up across a multi-hour unattended run on a Pico 2 W (
2DCB876B587EA334) plus an ESP32-C6 companion, since all four are host-provisioning matters rather than firmware ones.1. Unattended recovery did work here — but my failure class is not #3713's
Worth stating because it qualifies this issue's premise rather than contradicting it. Mid-session I flashed the RP2350 with an artifact that would not boot, and the board dropped to BOOTSEL. It recovered with no physical action: the bootrom fell back to BOOTSEL, the
RP2350mass-storage volume auto-mounted under/run/media/, andfbuild deploywrote a working image to it.That is a genuinely different failure class from #3713. There the board wedges before or during TinyUSB bring-up (or has a D+/D− fault), so the ROM bootloader never re-runs and no host software can reach it. Here the bootrom itself was still in charge, which is exactly the case where a host can recover unattended. Two host-side prerequisites made it work, and both are provisioning requirements:
/run/media/<user>/), because the UF2 path is a file copysudoprompt survives an unattended runAutoResearch's own watchdog bootloader escape (
AUTORESEARCH_BOOTLOADER_ESCAPE_RESETS, #3713) is the other half: after N consecutive watchdog resets the sketch drops to the bootloader deliberately, converting "wedged and unreachable" into "flashable target". That mechanism did its job on this bench.2. fbuild refuses to deploy across a USB-identity change — a genuine unattended trap
Filed as FastLED/fbuild#1430. A Pico 2 W's USB identity comes from whichever firmware is running, and fbuild's env-based port selection requires the current identity to match the target environment:
deploy -e rp2350deploy -e rp2350wrp23502E8A:000F"Pico 2"rp2350w2E8A:F00F"Pico 2W"I hit both directions. The refusal message asks for "a healthy USB CDC port selector" while
fbuild port scanreports that exact port ascdc=yes health=healthy, so it reads as a cabling fault. An explicit-p /dev/ttyACM0deploys the same board seconds later.Unattended this is a trap, not an inconvenience: a job that deploys
rp2350to a Pico 2 W has silently removed its own ability to deployrp2350w, with no warning at the time. Bench workaround until fbuild#1430 lands: always pass-p <port>explicitly rather than relying on environment-based selection.3. BLE cannot be tested on this host at all
bash autoresearch rp2350w --blefails host-side, not device-side:The adapter is present (
/sys/class/bluetooth/hci0) butsystemctl is-active bluetooth→inactiveandbluetooth.service could not be found— BlueZ userspace is not installed, sobleakhas noorg.bluezto talk to. Bench requirement: BlueZ installed andbluetooth.serviceenabled, otherwise #3861 and #3955's BLE GATT criteria are untestable regardless of firmware state. I did not enable it: that is a system configuration change needing root, which is not something to do unattended.4. Long runs get killed on a full page cache, not on real memory pressure
Six consecutive peer-OTA runs were killed by a memory monitor. A 20-minute sampler showed
MemAvailablenever below 77 GB of 131 GB. The actual trigger:Build I/O fills the page cache; with no swap, anything thresholding on
MemFreereads 1.4 GB and calls it exhaustion, whileMemAvailable— which counts reclaimable cache — correctly reports 80 GB.I initially blamed daemon growth (
fbuild-daemonreaches ~5.3 GB,zccache-daemon~3.6 GB) and reaped them. That appeared to help once, because it briefly returns pages toMemFree, then stopped working — the daemon was back at 5.26 GB within ten minutes and the run died anyway. The daemons were not the cause. For an unattended bench the useful levers are a monitor that readsMemAvailablerather thanMemFree, or configured swap; reaping processes only treats the symptom.zackees commentedon Sep 10, 2026
Correction to finding 2: the escape is
-p SER=<serial>, not-p <port>I recommended passing
-p <port>explicitly to work around fbuild's USB-identity trap. There is a better selector, and I found it in fbuild's own test suite rather than in the error message or any docs:-p SER=<serial>.Verified on the bench, both directions, on the same board that environment-based selection had just refused:
Why this matters for an unattended bench specifically: the serial is the only identifier that survives a firmware change. The VID:PID flips with the environment (that is the whole trap), and a device path like
/dev/ttyACM0can move when boards re-enumerate or a companion is attached — which on this bench is routine, since the ESP32-C6 and the RP take/dev/ttyACM2and/dev/ttyACM0in an order that depends on plug timing. The serial2DCB876B587EA334was stable across every flash, reset, BOOTSEL drop and re-enumeration in a multi-hour session.So the setup instruction this issue is after is: record each board's serial once, and address boards by
SER=thereafter — not by port path, and not by relying on environment-based selection.That also downgrades what I said about fbuild#1430 being an unattended blocker. It is a discoverability problem: the capability exists, the error message points elsewhere ("use a healthy USB CDC port selector", on a bench where
port scanalready reports the port healthy). Corrected on that issue too.