How to configur embed studio to debug project

I have been struggling to get debug working with my Nordic NRF52840-DK breakout (connected serrially to its USB port) board for over a week with no success. I can build my project with which is an incredibly simple Hello World plus input:

#include "mbed.h"

static BufferedSerial pc(USBTX, USBRX);

int main()
    printf("Hello World! #2\n");
    char msg[] = "Echoes back to the screen anything you type\n";
    char buff;
    pc.write(msg, sizeof(msg));
    while (1) {, 1);
        pc.write(&buff, 1);

Using mbed-os 6.15.1 and mbed studio 1.4.3.

I have installed the latest version of pyocd as python3 -mpip install -U pyocd which is at version 0.33.0. The pyocd.exe was installed in my windows 10 users\<user>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9... directory path (running python v3.9. I have placed its scripts directory in my path so I can execute pyocd from a command prompt w/o error.

I have tried starting the pyocd server ahead of time and even passed the NRF52840 target to it, where it defaults to cortex_m board.

In all cases, when I run the mbed studio debug, I get the message “timeout waiting for the gdb server to start”.

Does anyone recognize what steps I am missing to make this work?


I do not know if these information will help you, but maybe…

Take a look to Enabling debugging for unsupported boards - Monitoring and debugging | Mbed Studio Documentation. For example Nucleo-F767(Native) does not work for me, so i switched to the keil package and it seems to work.

If I remember, your own installation of Python and pyOCD is not the one what is used by MbedStudio (let say MS for more). The MS is delivered with package of all necessary software. So if you want to do something with the one what is used by the MS you need to visit -

  • for Python - C:\Users\YOU\AppData\Local\Mbed Studio\mbed-studio-tools\python
  • for pyOCD - C:\Users\YOU\AppData\Local\Mbed Studio\mbed-studio-tools\python\scripts

So all test you need to do via built-in terminal of MS and not via CMD of Windows, I think

BR ,Jan

I have an old DAPlink (pyOCD?) debugger module which still works.
Debugger | Datasheets | Particle

Just tested again using the blinky example with Mbed Studio 1.4.3 / MbedOS 6.16 and an old nRF52840 Xenon board. Debugger is a little slow but it did not timeout and I was able to step through the code.

Thanks for the help. I found this entry for CMSIS-DAP J-Link mode for my nRF52840-DK board (which is also an issue form my board :), but am hessitant to try it as I may brick my my J-Link connection.

Thanks, I will give this a try.