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
- Connect EV33A17A board via USB
- Erase chip:
pyocd erase --chip --target PIC32CK2051SG01144 --pack Microchip.PIC32CK-SG_DFP.1.6.199.pack
- 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
ap.py: MEM_AP.find_components() catches TransferError but swallows it (doesn't re-raise)
discovery.py: No fault tolerance wrapper - a single faulting AP blocks discovery on all APs
Proposed Fix
ap.py: Re-raise TransferError after logging so callers can handle it
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.
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
Microchip.PIC32CK-SG_DFP.1.7.234pyOCD Version
0.43.1.dev1(GitHub main branch)Steps to Reproduce
Error Output
Root Cause
ap.py:MEM_AP.find_components()catchesTransferErrorbut swallows it (doesn't re-raise)discovery.py: No fault tolerance wrapper - a single faulting AP blocks discovery on all APsProposed Fix
ap.py: Re-raiseTransferErrorafter logging so callers can handle itdiscovery.py: Add_safe_find_components()wrappers that catch the error, log a warning, and continueTested Fix
With the fix applied:
AP#1's FAULT is caught and logged as WARNING, discovery continues with remaining APs.