Skip to content

Connect dormant debug interfaces over SWD. - #69

Merged
jon merged 1 commit into
mainfrom
work/swd-dormant
Sep 14, 2026
Merged

jon merged 1 commit into
mainfrom
work/swd-dormant

Conversation

@jon

@jon jon commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Conn.Connect keeps 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 by dpidr, err := conn.Connect(ctx). Before this change, a target requiring dormant activation failed at that identity read; afterward, the connection can activate it automatically. Call conn.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) ran OSTIOLE_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 DPIDR 0x4c013477, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-14T00:12:01.259125Z 355adc0 Manual request
🔒 Security Review Completed 2026-09-13T23:03:03.876139Z 1b10e99 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jon

jon commented Sep 13, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 1b10e9950d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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.
@jon

jon commented Sep 14, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 355adc055b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@jon
jon merged commit 96c2ba9 into main Sep 14, 2026
9 checks passed
@jon
jon deleted the work/swd-dormant branch September 14, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant