pyOCD icon indicating copy to clipboard operation
pyOCD copied to clipboard

Family: Wrong regex for LPC55 breaks support for LPC54

Open imi415 opened this issue 1 year ago • 0 comments

The target family LPC5500 has a regex r'LPC55?[0-9]{2}.*', which accidently matches all LPC54 series MCUs. While using CMSIS-Pack targets for these MCUs, the sequence for LPC55 will be used instead of default behavior.

Ref: https://github.com/pyocd/pyOCD/blob/main/pyocd/target/family/init.py#L41

This causes reset_and_halt fails, and here are the details:

On LPC55, the AP#2 is the DM-AP, but on LPC54, this AP does exist with a different name called ISP-AP, which lacks the "Start Debug Session" or debug authentication related commands. Since the DM-AP does not exist, the MCU will not be reset since the correct sequence is never executed as the LPC55 unlock sequence has no effect on ISP-AP.

This is not easy to find by looking into the logs (as these MCUs does have AP#2 with compatible registers to DM-AP), and the only warning is the forced halt after polling has timed out.

...
0011500 D halting core 0 [cortex_m]
0011502 W had to forcibly halt core after reset [target_lpc5500]
0011506 I Done. [reset_cmd]
...

imi415 avatar Jul 23 '22 08:07 imi415