Nrf52 DK debug = unable to find CMSIS-DAP device

I’m giving a try to PlatformIO/VSCode on win10. I’m currently working with a nrf52 DK witch I can program with no problem: I tried the simple blink program and also one with soft device.
The problem is when launching debugger; I always get this =

Error: unable to find CMSIS-DAP device
.pioinit:12: Error in sourced command file:
Remote communication error. Target disconnected.: Success.

Any ideas to help me solve this?
Best Regards.

I also have some debug problems with nrf52-dk and mbed, see here

I haven’t really tried it wit CMSIS-DAP, but jlink works.

This is my current platformio.ini file

platform = nordicnrf52
framework = mbed
board = nrf52_dk
debug_tool = jlink
build_unflags = -Os
build_flags = -O1 -g3 -ggdb

With the last two lines

build_unflags = -Os
build_flags = -O1 -g3 -ggdb

I tried to solve my problem, but without success (not showing variables while debugging).

ok, thanks for your reply… in my case I don’t even enter debug mode.

It depends on the bootloader type. You can use CMSIS-DAP (DAPlink) or J-Link. It seems that your board flashed with J-Link debugger. Please open platformio.ini and add these lines to [env:nrf52_dk] section:

upload_protocol = jlink
debug_tool = jlink

Please don’t forget to install J-Link drivers. See “Drivers” section in J-LINK — PlatformIO latest documentation

wonderfull @ivankravets! it works just fine!
As far as I understood I will have to have those lines to every new project right? as platformio.ini is included inside each project directory.

Yes, if you are going to use J-Link as debug tool.