Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: [1] 2  Send TopicPrint
Very Hot Topic (More than 25 Replies) ESP32 Dev Board debugging (Read 7571 times)
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
ESP32 Dev Board debugging
Jan 10th, 2022 at 1:41pm
Print Post  
I tested the WiFiScan  example in the Arduino IDE and it works “out of the box” just fine. However, when I open the sketch in VS2019 with VM I cannot get debugging working. I select Start Debugging, the sketch builds and uploads (I need to press and hold “Boot” while pressing “Reset” on the WSP32 module). Looking at the Serial Port Monitor I do not see any output.

Here is my procedure:
  1. Set a breakpoint at the start of "Setup"
  2. Press F5 to start and debug
  3. Wait until I see the start of the download and then hold Boot on ESP32 while pressing and releasing Reset
  4. Observe the download completion and then press Reset on the ESP32
  5. Note the breakpoint is not hit.


Log file is attached.
Sid
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: ESP32 Dev Board debugging
Reply #1 - Jan 10th, 2022 at 2:07pm
Print Post  
Thanks for the report.

  1. Is your breakpoint after any Serial.begin() code you have?
  2. Is your baud rate set to 115200?
  3. Do you have the vMicro > Debugger > Reset Or Delay When Debug Starts option Enabled?
  4. Do you see any output in the Output Window > Micro Debug Trace option?


Also do you need to press the Reset + Boot buttons to perform the upload via Serial on the ESP32 Module? (I do not on a standard ESP32 Devkit C v4, and this added delay may cause issues)
  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Dev Board debugging
Reply #2 - Jan 10th, 2022 at 9:43pm
Print Post  
1. Yes the breakpoint is after Serial.begin
2. Yes the baud rate is 115200
3. Yes the Reset or Delay When Debug Starts is checked
4. I see the following in the MicroDebug Trace Window:

Launching Debugger...
   - Serial debug will start immediately. WiFi (or gdb) debug will start a few seconds or a short time after the remote device connects to the network.
   - Switch on 'vmicro>debugger>full speed' to prevent debugger message throttling. (read the docs)
   - If 'in-break live watch' is disabled, continue an existing paused debug session by sending the character 'c' to the board using the Serial window.
   - If uploading on WiFi but debug is on Serial then it is possible the cpu will be in debug break when OTA upload is attempting connect. If this is the case then sending char 'c' using the serial/debug terminal will force the mcu to continue (like F5).
   - WiFi debug? Wifi debug is not fully supported yet. Use the vMicro>Debugger menu to set an alternative debug port such as Serial (default speed is 115k)
   - To view debug messages without trace messages use the 'message windows' option on the monitor window.
   - Switch off this message and other Tutorial messages using the 'vMicro>General' menu
Program Running 'WiFiScan'
User Experience: The serial debugger was delayed waiting for an incoming line of data. If the Serial.print() command is used between breakpoints, then ensure that a line termnator is sent using .println() or .print("\r\n"). Optionally, use #if defined(VM_DEBUG) to add code that is only active when debugging. (if this is expected then switch this user experience message off in tools>options>visual micro>micro debug)

>>> Also do you need to press the Reset + Boot buttons ...
Yes I do. I am using an ESP32 breakout board not the ESP32 Dev Kit.

  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Dev Board debugging
Reply #3 - Jan 14th, 2022 at 6:06pm
Print Post  
This is very frustrating; in order to eliminate a hardware issue, I bought a couple of ESP32-DevKitC modules. They work fine with the Arduino IDE, but I still cannot get VM to debug them. 

I was expecting serial debugging to be stable and reliable.

Please advise how to get this working.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 Dev Board debugging
Reply #4 - Jan 14th, 2022 at 7:08pm
Print Post  
Hi, it should work correctly but to help you it would be easier to compare like for like with the Arduino IDE. That will help us prove that normal upload and serial is working correctly.

Please change the tool bar configuration from Debug to Release. That should switch the Serial debugger off unless you have manually enabled it? If you have manually enabled the debugger please switch it off.

With debug off please confirm that upload and using serial works correctly and the same as the arduino ide?

Then we can test that normal serial input/output is working.

Thanks

  
Back to top
WWW  
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Dev Board debugging
Reply #5 - Jan 14th, 2022 at 7:40pm
Print Post  
With the release build I can use the build and upload button and I see the output from the sketch in the serial monitor.
Sid
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 Dev Board debugging
Reply #6 - Jan 14th, 2022 at 9:17pm
Print Post  
Great thanks, that is working the same as the Arduino IDE.

Can you please close the solution and create a new test project. It doesn't need much code (see below).

Switch to debug and upload. That should automatically add a test breakpoint to the loop(){} and start debugging.

Does that work?


Code (C++)
Select All
// the setup function runs once when you press reset or power the board
void setup() {

}

// the loop function runs over and over again until power down or reset
void loop() {

}


 

  
Back to top
WWW  
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Dev Board debugging
Reply #7 - Jan 14th, 2022 at 9:39pm
Print Post  
Yes, the empty project appears to work.

Sid
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 Dev Board debugging
Reply #8 - Jan 14th, 2022 at 9:58pm
Print Post  
Okay thanks. 

When sharing the serial debugger with your own code there can be some considerations. Using a different serial port for debugging is an option and cleaner. However, sharing the serial port with serial output from user code is the default setting and the most common use of the debugger. It should work under nearly all conditions.

Before we investigate the actual issue can you try to comment the serial.begin() from your own code. Something in my memory says that some esp32 cores have a bug where the serial fails if serial.begin() is issue twice. the visual micro debugger does add a serial.begin() therefore for this test the one in our code is not needed.

Thanks
  
Back to top
WWW  
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Dev Board debugging
Reply #9 - Jan 14th, 2022 at 10:03pm
Print Post  
Commenting out the Serial.begin() allows the sketch to be debugged.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 Dev Board debugging
Reply #10 - Jan 14th, 2022 at 10:35pm
Print Post  
Good. I look back at history. This issue crept into an espcore some months ago. It has been reported on their git site by us and others. Which version of the core are you using? 

We havent had time to test if it is fixed yet? If not then we might have to add some form of check for esp32 boards.
  
Back to top
WWW  
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Dev Board debugging
Reply #11 - Jan 14th, 2022 at 10:42pm
Print Post  
How do I find the ESP32 core version? I assume it is latest, installed in the last few days.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 Dev Board debugging
Reply #12 - Jan 14th, 2022 at 10:53pm
Print Post  
If you open the platform explorer and click the board manager tab then expand the esp32 entry you will see which is installed.

It sounds like the latest. In future release we will have to try to zap the 2nd serial begin behind the scenes until they fix it.
  
Back to top
WWW  
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Dev Board debugging
Reply #13 - Jan 15th, 2022 at 5:05pm
Print Post  
I did not see a place that displayed the version, however, when I hover over a board name under ESP32 I see them in a folder "1.0.6".
Sid
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 Dev Board debugging
Reply #14 - Jan 15th, 2022 at 5:31pm
Print Post  
I am not sure how a new install resulted in 1.0.6. We normally recommend stable but I tested with the latest RC1 and they have fixed it. It is possble it was also fixed in the stable 2.0

You can expand the esp32 node in board manager, that is where you will see the versions. The "grayed" one is the one that is installed. You can click it to uninstall and click a different version to install. Click the "Rescan" when done or restart the ide.



« Last Edit: Jan 15th, 2022 at 5:31pm by Tim@Visual Micro »  

Please Register or Login to the Forum to see File Attachments
Back to top
WWW  
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Dev Board debugging
Reply #15 - Jan 15th, 2022 at 5:39pm
Print Post  
OK< my problem was I did not see a TAB labeled Board Manager, did not realize the TABs scrolled. 

Indeed, ESP32 is shown installed as version 1.0.6.

Are you suggesting 1.0.6 is not the latest stable for ESP32?

Sid
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 Dev Board debugging
Reply #16 - Jan 15th, 2022 at 5:46pm
Print Post  
The version list comes from the authors of the esp32. Their web site or git site will explain what is stable. However looking at the list the 2.0.2 appears to be the latest stable. If the entries are not shown as beta or rc then they are stable.
  
Back to top
WWW  
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Dev Board debugging
Reply #17 - Jan 15th, 2022 at 5:51pm
Print Post  
I am using Arduino v1.8.19 IDE, I assume v2 ESP32 is for the V2 IDE.
Sid
« Last Edit: Jan 15th, 2022 at 5:51pm by Sid Price »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 Dev Board debugging
Reply #18 - Jan 15th, 2022 at 5:54pm
Print Post  
No, the toolchain versions have no bearing to an arduino ide version but I can understand why you might have thought that Smiley

The arduino ide 2 is same as the 1x IDE but does not have any built in libraries or toolchains.
« Last Edit: Jan 15th, 2022 at 5:55pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Dev Board debugging
Reply #19 - Jan 15th, 2022 at 6:03pm
Print Post  
Interesting the Arduino 1.8 IDE does not offer an update to anything later than 1.0.6.
Sid
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint