Connect dormant debug interfaces over SWD. - #69
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Targets which require dormant activation do not answer the existing JTAG-to-SWD entry. Retry the initial DPIDR read once through dormant activation after a completed invalid-ACK response. Use the same path when release must repair framing before restoring owned state. Do not use dormant activation to retry other identity-read failures. Keep ordinary register calls at one attempt, and fit activation within the existing wire transfer size. The RP2350/J-Link bench now connects, confirms identity on reconnect, and completes release after line-reset repair.
|
@codex review |
1b10e99 to
355adc0
Compare
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Conn.Connectkeeps JTAG-to-SWD as its first attempt. If the initial DPIDR read returns an invalid ACK and the trailing clocks complete, it sends JTAG-to-dormant and dormant-to-SWD, then reads DPIDR once more. Release uses the same fallback when it must repair framing. Each activation exchange fits within the 136 clocks already required by JTAG-to-SWD entry.The calls stay the same:
conn := swd.New(wire), followed bydpidr, err := conn.Connect(ctx). Before this change, a target requiring dormant activation failed at that identity read; afterward, the connection can activate it automatically. Callconn.Release(cleanupCtx)before closing the wire, using an independent cleanup context, and retain the connection for retry if release fails, including after a failed Connect. Release restores owned ORUNDETECT state and leaves SWD selected.Parity, WAIT, FAULT, and transport errors do not trigger dormant activation. Ordinary register operations still make one attempt. No new caller options or ADIv6 AP support are added.
Why
An RP2350 connected through a J-Link EDU Mini V2 returned an invalid ACK to the existing JTAG-to-SWD entry. OpenOCD received the same response, then activated SWD through dormant mode and read DPIDR successfully. The missing transition belongs in SWD connection and cleanup, where every adapter can use it.
Documentation
The architecture and capability notes describe the fallback and release behavior. The SWD guide gives the activation sequence, retry boundary, and RP2350 bench procedure.
Hardware evidence
On macOS, two fresh J-Link EDU Mini V2 sessions (serial
000802011345, RP2350 SWD at 100 kHz) ranOSTIOLE_JLINK_HIL=1 OSTIOLE_JLINK_HIL_SERIAL=000802011345 go test -tags=integration ./jlink -run '^TestHILJLinkSWDDPIDR$' -count=1 -v. Before each run, OpenOCD 0.12.0 connected and shut down using the DAP-only command recorded in the SWD guide; its shutdown sends the interface out of SWD. Both runs returned DPIDR0x4c013477, matched identity on reconnect, and completed release after line-reset repair. USB cleanup also completed.The runs did not independently verify ORUNDETECT after release or exercise AP or target-memory access through Ostiole. The bench was not power-cycled, and no processor halt or reset was requested.