Skill v1.0.2
currentAutomated scan100/100~4 modified
version: "1.0.2" name: mcu-peripheral-debug description: Inspect and safely modify MCU peripheral registers and bit fields from the EmberProbe workspace SVD. Use when the user asks about GPIO, timers, UART, clocks, control/status registers, peripheral configuration, or named SVD register fields. Requires a paused debug session (EmberProbe built-in debugger or Cortex-Debug) for hardware reads and writes.
MCU Peripheral Debug
Use scripts/peripheral.js from this skill directory. Do not parse the SVD or construct raw DAP/OpenOCD commands yourself.
Before you run
- MCP first: if this session provides EmberProbe MCP tools (such as
peripherals_read), use them; the scripts here are the fallback. The authorization and hardware rules on this page apply to both. - Applies to: inspecting and safely modifying MCU peripheral registers and bit fields from the workspace SVD.
- Requires: the EmberProbe Agent Bridge and an SVD bound to the workspace.
--read/--setalso need a unique paused debug session (EmberProbe built-in debugger or Cortex-Debug) and connected hardware;--listonly parses the SVD (no hardware). - Preconditions:
--listneeds a bound SVD (elseSVD_NOT_CONFIGURED);--read/--setneed the target already paused (never pause implicitly);--setneeds explicit per-write confirmation. - Side effects:
--list/--readare read-only (EmberProbe refuses reads with SVD-declared side effects);--setwrites registers and verifies by readback. - Success evidence:
--listreturns matched peripherals;--readreturns exact hex values plus decoded fields;--setreturns a plan, then after confirmation the readback. A--listsuccess does not prove hardware reads work, and a session-gate failure does not prove the register path is broken.
For failure handling, retry limits, cross-skill routing, and result scoping, read ../_emberprobe/agent-workflow.md.
List or search the configured SVD without touching hardware:
node <skill-dir>/scripts/peripheral.js --workspace <workspace> --listnode <skill-dir>/scripts/peripheral.js --workspace <workspace> --list --query gpio
Read named registers while the unique debug session is paused:
node <skill-dir>/scripts/peripheral.js --workspace <workspace> --read GPIOA.MODER,USART1.SR
The result includes exact hexadecimal register values plus decoded fields and enumeration names. A batch is preflighted before hardware access: if any paths are unknown, no registers are read and SVD_TARGET_NOT_FOUND reports every bad path in details.invalidTargets. Correct the whole batch using --list or --query, then retry once. Never pause a running target implicitly; if TARGET_NOT_PAUSED is returned, report that the user must pause first. EmberProbe refuses write-only registers and reads with SVD-declared side effects.
Peripheral writes require confirmation every time
node <skill-dir>/scripts/peripheral.js --workspace <workspace> --set GPIOA.MODER.MODE0=Output
The first call only returns a write plan with the current and final register values. Show every planned register change in the Agent conversation and ask whether to allow this write once or deny it. Only after an explicit approval, repeat the identical command with the returned ID. EmberProbe does not display a second operation approval dialog:
node <skill-dir>/scripts/peripheral.js --workspace <workspace> --set GPIOA.MODER.MODE0=Output --confirm <confirmationId>
There is no persistent trust mode. Confirmations expire after five minutes, are single-use, and are invalidated if the SVD, debug stop, current register value, or requested write changes. Values may be decimal or hexadecimal; an enumeration name is accepted only when that exact field declares it in the SVD. When INVALID_PERIPHERAL_WRITE_VALUE is returned, use details.allowedEnumerations when present instead of guessing a name. EmberProbe permits only ordinary read-write registers; it rejects read/write side effects and write-once semantics rather than guessing.
On failure, parse the stderr diagnostic and report its error.code, likelyCause, suggestedActions, and details.