Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions pyocd/coresight/dap.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,18 +461,23 @@ def disable_debug_port_hook(self) -> Optional[bool]:
return cst.call_pre_discovery_debug_sequence('DebugPortStop')

def _connect(self) -> None:
# Connect the probe.
probe_conn = ProbeConnector(self.probe)
probe_conn.connect(self._protocol)

# Attempt to connect DP.
connector = DPConnector(self.probe)
if not self.connect_debug_port_hook():
connector.connect()
self.dpidr = connector.idr
else:
# We still need to read the IDR for our own use.
self.dpidr = connector.read_idr()
try:
# Connect the probe.
probe_conn = ProbeConnector(self.probe)
probe_conn.connect(self._protocol)

# Attempt to connect DP.
connector = DPConnector(self.probe)
if not self.connect_debug_port_hook():
connector.connect()
self.dpidr = connector.idr
else:
# We still need to read the IDR for our own use.
self.dpidr = connector.read_idr()
except exceptions.Error as err:
LOG.error("%s", err)
raise exceptions.Error(
"Target not detected. Check connection to target. Potentially reduce debug clock.") from err
assert self.dpidr

# Report on DP version.
Expand Down
Loading