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 Send TopicPrint
Normal Topic Stuck trying to debug an example program. (Read 2109 times)
Taurus Bass Pedals
Junior Member
**
Offline


Posts: 13
Joined: Jun 11th, 2021
Stuck trying to debug an example program.
Jun 29th, 2021 at 4:36pm
Print Post  
Hi, I'm trying to debug (starting by setting a breakpoint) a Sparkfun example program.  I'm completely at a loss to figure out what's happening.  Here is a painfully detailed description of the steps I'm taking:

1. Run Arduino IDE.
2. Sketch -> Include Library -> Manage Libraries.
3. In Library Manager, search for "sparkfun_bio".
4. Install Sparkfun Bio Sensor Hub Library.
5. Close Library Manager.
6. Select board (I'm using ESP32) and COM port under Tools.
7. File -> Examples -> Sparkfun Bio Sensor Hub Library -> Example1_config_BPM_Mode1.
8. Verify to compile the sketch.
9. Upload to the target.
10. Tools -> Serial Monitor OR run a terminal emulation program; ensure baud rate is 115200.
11. View the following in the serial window:

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4
Could not communicate with the sensor!!!
Configuring Sensor....
Error configuring sensor.
Error: 255
Loading up the buffer with data....
Heartrate: 0
Confidence: 0
Oxygen: 0
Status: 0
Heartrate: 0
Confidence: 0
Oxygen: 0
Status: 0
...
(note that the "Could not communicate with the sensor!!!" message is where the application begins writing messages.  The error messages are expected, as I haven't actually connected the sensor kit to the ESP32)

12. Close Arduino IDE (and terminal emulation program if used).
13. Open Visual Studio Community 2019.
14. Extensions -> vMicro -> Visual Micro Explorer.
15. In Micro Explorer, Examples -> Sparkfun_Bio_Sensor_Hub_Library -> Example1_config_BPM_Mode1 -> Open Copy.
16. Close Micro Explorer.
17. Select Release, build and upload to the target.
18. Extensions -> vMicro -> View Port Monitor OR run a terminal emulation program; ensure baud rate is 115200.
19. View the same serial data as #11 above.
20. Select Debug, build and upload to the target.
21. The Serial window shows only:

Opening port
Port open

and a popup with a bunch of tips appears.  
If I click the Connect button in the Serial window, it shows

Port closed
Opening port
Port open

and the tips popup reappears.
I can't tell what is actually happening here.
The Build, Build/Upload and Stop Debugger buttons are all live in the toolbar.
The state of the Auto Toolbar Visibility doesn't have any affect on them.
Also the Start button next to the green arrow is live, but does nothing if I click it.

Please advise what I'm missing or doing wrong.  Thank you.
« Last Edit: Jun 29th, 2021 at 4:39pm by Taurus Bass Pedals »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2144
Joined: Feb 13th, 2019
Re: Stuck trying to debug an example program.
Reply #1 - Jun 29th, 2021 at 5:13pm
Print Post  
Thanks for the report and detail.

When opening the project in vMicro (Step 17 and/or step 20):
1) Ensure you have the "Debug" Configuration selected
2) Set a breakpoint in the sketch
3) Ensure the Debug: Serial option is selected (1 may have changed this to Off)

Does this improve the situation?



  
Back to top
 
IP Logged
 
Taurus Bass Pedals
Junior Member
**
Offline


Posts: 13
Joined: Jun 11th, 2021
Re: Stuck trying to debug an example program.
Reply #2 - Jul 6th, 2021 at 1:38pm
Print Post  
Hi Simon,
I did everything as directed in your reply, got the same results.  Below is what's shown in the Output window. Thanks

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 'Example1_config_BPM_Mode1'
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)
  
Back to top
 
IP Logged
 
Taurus Bass Pedals
Junior Member
**
Offline


Posts: 13
Joined: Jun 11th, 2021
Re: Stuck trying to debug an example program.
Reply #3 - Jul 6th, 2021 at 1:43pm
Print Post  
I meant to add, one of the things that I'm really finding confusing is that I find it difficult to know what state it's in, because a set of mutually exclusive commands is enabled.  e.g., after starting the debugger, I see "Build", "Build & Upload" and "Stop Debugger" all enabled in the Extensions->vMicro menu.  How could I Build & Upload without stopping the debugger first ?  Also, the VS Start button is enabled, although it doesn't seem to do anything if I click it.
« Last Edit: Jul 6th, 2021 at 3:47pm by Taurus Bass Pedals »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Stuck trying to debug an example program.
Reply #4 - Jul 17th, 2021 at 2:34am
Print Post  
It is difficult to know what you have configured and if your own sketch code uses the serial port, if so that needs a line terminator.

for a better overview and response we need the info showin the yellow box near the top of this page. That will also show us your build folder allowing us to point you to another file we need to see.

Thanks
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint