Debugger error “STLink error (17): AP fault”

Hello,

I’m using NUCLEO-WL55JC1 with Mbed studio 1.4.3
image

ST-Link firmware:

The program is a simple code to test the debugger:

#include "mbed.h"

// Blinking rate in milliseconds
#define BLINKING_RATE     500ms

int main()
{
    // Initialise the digital pin LED1 as an output
    DigitalOut led(LED1);
    int i=0;
    while (true) {
        printf("hello %i\n", i++);
        led = !led;
        ThisThread::sleep_for(BLINKING_RATE);
    }
}

When I try to debug, I have the following Traceback:

Selected port 50000 for debugging
0000556:INFO:board:Target type is stm32wl55jcix
0000600:INFO:coresight_target:Asserting reset prior to connect
0000678:INFO:dap:DP IDR = 0x6ba02477 (v2 rev6)
0000725:INFO:ap:AHB-AP#0 IDR = 0x24770011 (AHB-AP var1 rev2)
0000754:INFO:ap:AHB-AP#1 IDR = 0x84770001 (AHB-AP var0 rev8)
0000774:ERROR:discovery:Exception reading AP#1 IDR: Memory transfer fault (STLink error (17): AP fault)
Traceback (most recent call last):
  File "/home/yerly/.config/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/coresight/discovery.py", line 162, in _create_1_ap
    ap = AccessPort.create(self.dp, ap_address)
  File "/home/yerly/.config/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/coresight/ap.py", line 350, in create
    ap.init()
  File "/home/yerly/.config/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/utility/concurrency.py", line 28, in _locking
    return func(self, *args, **kwargs)
  File "/home/yerly/.config/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/coresight/ap.py", line 1105, in init
    super(AHB_AP, self).init()
  File "/home/yerly/.config/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/utility/concurrency.py", line 28, in _locking
    return func(self, *args, **kwargs)
  File "/home/yerly/.config/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/coresight/ap.py", line 721, in init
    _init_hprot()
  File "/home/yerly/.config/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/coresight/ap.py", line 689, in _init_hprot
    csw = AccessPort.read_reg(self, self._reg_offset + MEM_AP_CSW)
  File "/home/yerly/.config/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/utility/concurrency.py", line 28, in _locking
    return func(self, *args, **kwargs)
  File "/home/yerly/.config/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/coresight/ap.py", line 412, in read_reg
    return self.dp.read_ap(self.address.address + addr, now)
  File "/home/yerly/.config/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/coresight/dap.py", line 713, in read_ap
    result_cb = self.probe.read_ap(addr, now=False)
  File "/home/yerly/.config/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/probe/stlink_probe.py", line 183, in read_ap
    result = self._link.read_dap_register(apsel, addr & 0xffff)
  File "/home/yerly/.config/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/probe/stlink/stlink.py", line 434, in read_dap_register
    self._check_status(response[:2])
  File "/home/yerly/.config/Mbed Studio/mbed-studio-tools/python/lib/python3.7/site-packages/pyocd/probe/stlink/stlink.py", line 303, in _check_status
    raise self._ERROR_CLASSES[status](error_message)
pyocd.core.exceptions.TransferFaultError: Memory transfer fault (STLink error (17): AP fault)
0000918:INFO:rom_table:AHB-AP#0 Class 0x1 ROM table #0 @ 0xe00ff000 (designer=020 part=497)
0000933:INFO:rom_table:[0]
0000941:INFO:rom_table:[1]
0000949:INFO:rom_table:[2]
0000957:INFO:rom_table:[3]
0000965:INFO:rom_table:[4]
0000973:INFO:rom_table:[6]
0000981:INFO:cortex_m:CPU core #0 is Cortex-M4 r0p1
0001029:INFO:dwt:4 hardware watchpoints
0001074:INFO:fpb:6 hardware breakpoints, 4 literal comparators
0001187:INFO:coresight_target:Deasserting reset post connect
0001232:INFO:server:Semihost server started on port 4444 (core 0)
0001247:INFO:gdbserver:GDB server started on port 50000 (core 0)
Reading symbols from /home/yerly/Mbed Programs/mbed-os-example-blinky-stm32/BUILD/NUCLEO_WL55JC/ARMC6/mbed-os-example-blinky-stm32.elf...
warning: 
Loadable section "RW_IRAM1" outside of ELF segments
done.

I have the version 0.30.1 of pyocd and pyocd see the board:

How can I fix it?

Best regards.

Hi @Louka_Yerly,

did you manage to fix it?

Unfortunately I have exactly the same problem.

I’m using Mbed Studio 1.4.4