Strange behavior with RP2040 debugger

I just setup a minimalist project with a Raspberry Pico debugger and it behave strangely. Any suggestion would be greatly appreciated.

In my program I set two breakpoints, at the first line of setup() and at the first line of loop(). When I start debugging it stops correctly at main(). I click resume and it stops correctly at setup(), I click resume and it doesn’t stop at loop() as expected. However, If I remove the setup() breakpoint and restart, it does stop correctly at loop().

Any idea why it doesn’t stop correctly at loop() after setup()?

The debug log is at undefinedC:\Users\user\.platformio\packages\toolchain-gccarmnoneeabi\bin\arm-non -



platform = raspberrypi
board = pico
framework = arduino
debug_tool = cmsis-dap


#include <Arduino.h>

void setup() {
 pinMode(25, OUTPUT);

void loop() {
    digitalWrite(25, true);
    digitalWrite(25, false);

cmsis-dap: incorrect upload of debug.ELF

that’s what happened when i used it for the first time
I fixed it but I don’t remember exactly what it was… it’s been a long time

In my opinion, the build type must be set to debug.
build_type = debug

@sivar2311 adding build_type = debug resulted in the same behavior.

@wizio, it seems to be related to SERIAL_CDC in pins_arduino.h. If I comment it out the problem disappears. Also, if I add a delay before the breakpoint in setup(), it does work, as if the CDC connection needs time to settle down. Does this ring any bell?

// #define SERIAL_CDC			1


EDIT: Delay of 100ms doesn’t work. 250ms does work. I set mine to 500ms.

honestly, i don’t remember…
this, then, worked

1 Like