Arm Mbed OS support forum

Can't debug with Nucleo STM32F411RE : STLink error (22)


I try to debug the mbed-os-example-mbed5-blinky program (I start with very simple thing !) and I have an error : STLink error (22). Then… nothing : every debug icons are grey.

I can build and upload to the board with success but if I click on debug, there is no upload.

Mbed Studio, ST-link drivers and firmware are up to date. The board is supported for debuging.

You can see messages on debug console on the pictures.

Do you have an idea ?

Sorry, but debugging with mbed studio is really crap compared with the STM Cube IDE.
Even when it works without errors and gdb server crashes, you cant dive into mbed library sources because the source code files are not found by the studio. And the next debugger crash is just a matter of minutes…

All this works reliable with the STM IDE. I managed to set up a project using mbed 5.14 with STM32 NUCLEO-L432KC by exporting a project from the mbed online compiler and importing into STM IDE. Some work with missing include pathes and a few missing symbols had to be done, until it compiled with only two warnings about deprecated functions, but nothing magical.

Hello Szorn,
Thank you for your answer. I will see the STM Cube.

1 Like

I think the current STM32CubeIDE upgrades the stlink to a version which is incompatible with previous stlink versions, which causes other tools not to work with stlink. So you might try the ST-utility to update stlink to another version of stlink firmware.

ST-utility is not very up to date… please use:


I am getting the same all of a sudden. I cannot debug, and programming produces errors.

I have the same issue on STM targets with programs built using Mbed OS 6.6.0.

Changing the STM-Link firmware revision did not help.

One way how to recover such board is to erase the chip’s flash memory with the STM32CubeProgrammer. Make sure you keep the Reset button pushed on the Mbed board when clicking on the Connect button on the STM32CubeProgrammer. Otherwise it won’t connect. When connected you can release the Reset button. Once the board is recovered you can continue to use it with Mbed OS 6.5.0 or earlier.

I concur. Mbed OS 6.6 does not work with ST Link.

If you have upgraded to v6.6, what I’ve told my students is as follows:

  • Delete your BUILD and mbed-os folders
  • Replace mbed-os.lib with an earlier version (simply create a new blinky and pinch it from there)
  • Click the library tab and click repair (not upgrade!)

I am also finding GCC to work more reliably with debugging.


Do you think this can be due to

Then , could you apply .



Thank you Jerome for looking into this issue. Unfortunately, neither

    "target_overrides": {
        "*": {
            "target.gpio_reset_at_init": false


    "target_overrides": {
        "*": {
            "target.gpio_reset_at_init": 0

fixed the issue.

Happy new year and best regards, Zoltan


Thank you for reporting this issue. We are investigating it together with the Mbed OS team.

Arek - Mbed Studio team

Hi @jeromecoutant,

Your PR is the solution on my side.

I think it has something to do with the SWD connection, used while debugging (maybe it didn’t like the gpio reset at init).

Both my J-LINK probe and ST-LINK probe are now working in debug mode with my boards and MBED 6.6.

Thank you :+1:

1 Like

Hello Jerome,

After erasing the chip (deleting the program built with Mbed OS 6.6.0) using the STM32CubeProgrammer and modifying the Mbed OS 6.6.0:




according to your proposal the programming and debugging works OK.

Thank you, Zoltan