PlatformIO Community

Debug and serial monitor

Using the serial monitor works fine when doing upload. I just do platformIO:upload and the serial monitor opens and messages are displayed.

With the mkr1010wifi powered by USB cable connected to a 5 V power supply, debugger is fine. I can step through my program but no serial port.

With the mkr1010wifi powered to a PC USB port, the debugger works fine until USBDevice.attach() is executed.
image
At this point, windows10 send a ‘USB device not connected’ and the windows device manager gives error code 43
image

Is it possible to debug with a PC USB port and the serial monitor?

Try and set a breakpoint after the USB conenction has been established. (debug_init_break = break setup in the platformio.ini).

From developing stuff with USB-enabled microcontrollered I got the experience that you shouldn’t try and interrupt the USB setup phase, but after that, you can halt the microcontroller for quite some lengthy time before it loses its USB connection.

A different issue could be that certain code does not work when compiled with debug optimization. Add debug_build_flags = -Os -g -ggdb3 to the platformio.ini to do a Release+DebugInfo build and check if that survives the USB setup.

It doesn’t help. Still the same USB error code 43.
Do you have others suggestions?

Please open an issue at Issues · platformio/platform-atmelsam · GitHub so that the developers can have a look at it.

See topic Cannot debug ledControl example of ArduinoBLE on mkr1010 with jlink plus probe

1 Like