Skip to content

TransferFaultError during AP component scan aborts discovery on devices with secured APs #1921

Description

@kumar-mohan-s

Problem

When connecting to devices with secured/locked Access Ports (e.g., PIC32CK-SG with HSM), pyOCD fails during CoreSight discovery. The error from a faulting AP prevents discovery of cores on other, accessible APs.

Device

  • MCU: PIC32CK2051SG01144 (Cortex-M33 with HSM containing locked M0+)
  • Board: EV33A17A (PIC32CK SG Curiosity Ultra)
  • DFP: Microchip.PIC32CK-SG_DFP.1.7.234

pyOCD Version

0.43.1.dev1 (GitHub main branch)

Steps to Reproduce

  1. Connect EV33A17A board via USB
  2. Erase chip:
    pyocd erase --chip --target PIC32CK2051SG01144 --pack Microchip.PIC32CK-SG_DFP.1.6.199.pack
  3. Connect:
    pyocd commander --target PIC32CK2051SG01144 --pack Microchip.PIC32CK-SG_DFP.1.6.199.pack -v

Error Output

0001603 E Transfer error while reading AHB-AP#1 ROM table: Memory transfer fault (SWD/JTAG communication failure (FAULT ACK)) @ 0xe00fffd0-0xe00fffff ap
0001604 E Error while initing target: No cores were discovered! commander

Root Cause

  1. ap.py: MEM_AP.find_components() catches TransferError but swallows it (doesn't re-raise)
  2. discovery.py: No fault tolerance wrapper - a single faulting AP blocks discovery on all APs

Proposed Fix

  1. ap.py: Re-raise TransferError after logging so callers can handle it
  2. discovery.py: Add _safe_find_components() wrappers that catch the error, log a warning, and continue

Tested Fix

With the fix applied:

0001979 E Transfer error while reading AHB-AP#1 ROM table: Memory transfer fault ... ap
0001979 W AP##1 returned FAULT during component scan, skipping: Memory transfer fault ... discovery

AP#1's FAULT is caught and logged as WARNING, discovery continues with remaining APs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions