Debugging Arduino PlatformIO and Windows

Hi,

I am trying to debug an Arduino with PlatformIO on Windows. To do that I have followed this post

It worked perfectly on Linux (Ubuntu 18). But when I try the same on Windows 10 it does not work.
It does not work means that the Building in Debug Mode works perfectly, see image below

But the debug console is completely empty and it does not stop in any of the breakpoints

I have just started debugging Blink Code as simple as possible

#include <Arduino.h>
#include "avr8-stub.h"

int counter = 0;
// the setup function runs once when you press reset or power the board
void setup()
{
  // initialize digital pin LED_BUILTIN as an output.
  debug_init();
  pinMode(LED_BUILTIN, OUTPUT);
  // Serial.begin(9600);
}

// the loop function runs over and over again forever
void loop()
{
  // Serial.println("Loop Started");
  counter = counter + 1;
  breakpoint();
  digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
  delay(1000);                     // wait for a second
  digitalWrite(LED_BUILTIN, LOW);  // turn the LED off by making the voltage LOW
  delay(1000);                     // wait for a second
}

Does someone have any idea what can it be the problem?
Thank you very much in advance

What is your exact platformio.ini?

I have the following platformio.ini

I have tested with avr-stub and simavr debug_tools to see if it was on the arduino uno

[env:uno]
platform = atmelavr
board = uno
framework = arduino

;debug_tool = avr-stub
;debug_port = COM11
debug_tool = simavr

lib_deps =
    jdolinay/avr-debugger @ ~1.4

Windows Version: 10.0.19041
VS Code Version: 1.63.2
PlatformIO Versions - Core: 5.2.4 and Home:3.4.0

Thanks for your reply!

Is COM11 your port? Have you tried adding

debug_port = \\.\COM11

in the platformio.ini?

Yes, I have tried that already

And also I have checked that COM11 is the right port with “pio device list”

I was also able to upload the code through COM11 without issues

This really shouldn’t happen, there should at least be an attempt to startup.

What extensions do you have installed in VSCode?

Do you think it can be caused by the extensions?? I have a few of them, I click on a recommendation from VSCode and installed a lot of them

Better C++ Syntaxix
C/C++
C/C++ Extension Pack
C/C++ Themes
CMake
CMake Tools
Doxigen Documentation
Jupyter
Jupyter Keymap
Jupyter Notebook Render
PlatformIO IDE
Pylance
Python
Remote-Containers
Remote SSh
Remote WSL

I will disables some of them and test again

I have disabled the not needed ones and it didn’t work as well.

Very strange. I don’t know what can I else try…

There seems to be a general problem with PlatformIO debugging now, although I cannot reproduce it. See Debugging does not start · Issue #2925 · platformio/platformio-vscode-ide · GitHub. You’re not the only one.

1 Like

Wow! Thank you very much for the support and the issue documentation
Problem is solved and now it is working with the new update of platformio

Hello, could you do real time debugging with arduino?

Hi, I have the same issue, problem is, when i use the general like variables and incrementing decrementing of it and really simple stuff that is not really Arduino related, debugging works just fine, it starts and let me to go to the next steps with the console, the problem is, when I add additional code that interacts with the sensors on the Arduino (in my case gyroscope), the debug starts just fine, but it does not let me to go to the next steps of the program, does anyone know why it is happening? im not sure why, thanks.