PlatformIO Community

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
image

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 https://github.com/platformio/platformio-vscode-ide/issues/2925. 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?