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
Hot Topic (More than 8 Replies) Arduino struggles in debugging (Read 5228 times)
RonOhmer
Junior Member
**
Offline


Posts: 29
Joined: Feb 10th, 2015
Arduino struggles in debugging
Apr 21st, 2017 at 3:57pm
Print Post  
I have a few questions (Paid customer, using Arduino Duo/VS2017):
1. Is there a way to turn off all those ReadWord/WriteWord messages in the upload
2. My breakpoints arent working properly, I cant inspect anything.  My "Expressions on COM4" window is perpetually showing "Waiting for debug breakpoint data" even after a breakpoint is hit.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino struggles in debugging
Reply #1 - Apr 21st, 2017 at 4:20pm
Print Post  
Hi,

I am having a problem understanding the report or questions. Can you help please.

Do you mean you are using an Arduino Due?

What do you mean about "ReadWord/WriteWord messages"? Maybe you have enabled vMicro>Compiler>Verbose or  Upload>Verbose? This will cause the atmel tool chain to show additional messages??

I guess you are not using gdb so you must be using the standard visual micro serial debugger? It's a replacement for serial.print and serial.read allowing named variables (prior to upload to be watched? If you have not switched off "vMicro>General>Tutorial Mode" and you do not have any breakpoints in your code and you have the tool bar configuration set to "Debug" then you will see a demo breakpoint showing how they work. Alternatively the documentation is here

Does this help?
  
Back to top
WWW  
IP Logged
 
RonOhmer
Junior Member
**
Offline


Posts: 29
Joined: Feb 10th, 2015
Re: Arduino struggles in debugging
Reply #2 - Apr 21st, 2017 at 4:31pm
Print Post  
Yes, I meant Due.  Sorry about that.  I will try your suggestions and report back the results.
  
Back to top
 
IP Logged
 
RonOhmer
Junior Member
**
Offline


Posts: 29
Joined: Feb 10th, 2015
Re: Arduino struggles in debugging
Reply #3 - Apr 22nd, 2017 at 3:25am
Print Post  
Ok, I got rid of the annoying messages.  Thats good Smiley

The problem I have now is nothing is showing up in debug.

I am using ArduinoLog (Simple wrapper lib for Serial).

I have tried both SerialUSB.begin(115200) and Serial.begin(115200).

I am now using the native port, as it seems faster than the programming port.

Here is my code:
     // Start Logging
     SerialUSB.begin(115200);
#ifdef DEBUG
     Log.begin(LOG_LEVEL_VERBOSE, &Serial);
#else
     Log.begin(LOG_LEVEL_WARNING, &Serial);
#endif

Then later I have stuff like:
Log.verbose("UIElement((%d,%d),%T,%T) created", position.x, position.y, needsUpdate, uiTarget);

I would expect this to show up in the Serial |COM5 monitor (Thats my com port for my due native USB).


As you can see from the attachment, no "Expressions on COM5" nor any info on Serial window.

Breakpoints are awesome, but I need to actually see whats going on when broken, maybe I am missing something.
  

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino struggles in debugging
Reply #4 - Apr 22nd, 2017 at 12:59pm
Print Post  
It looks like the uploader, the visual micro debugger and your own code is using the Serial port on COM5 ?

The visual micro debugger, by default but optional,  will be performing a Serial.begin(115200) so if you were to use your code with the tool bar set to Release configuration (not Debug) then your logging won't work because your code isn't starting the serial. (It will not matter if both your code and visual micro start the serial)

You need to tell each breakpoint which variables/expressions you want to watch by entering them into the breakpoint action > message. You have a clear red spot for a breakpoint which I think shows you have not configured the breakpoint. This is a useful page from the visual micro docs http://www.visualmicro.com/page/User-Guide.aspx?doc=Working-With-Breakpoints-Whe...

If you delete the breakpoint that you have added and then compile and upload you should see a demo breakpoint that shows how to add millis() as a watch expression. You will see that in a breakpoint message you can add text and or watch expressions and optional configure condition or hit counter.

Because the debugger uses serial I would avoid trying to trace or break on a logging line of code and make sure your own log output works like serial.println() adding the line terminator.

What is code from your log() function?

ps: when you say its a bit quicker with serialusb I don't understand what you mean. You should switch vmicro>debugger>full speed debugging on if speed is important. 




« Last Edit: Apr 22nd, 2017 at 1:22pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
RonOhmer
Junior Member
**
Offline


Posts: 29
Joined: Feb 10th, 2015
Re: Arduino struggles in debugging
Reply #5 - Apr 22nd, 2017 at 4:58pm
Print Post  
What I meant was it seems to upload faster on the Native USB port as opposed to the Programing port.

That being said...

Now for a test I simply did the following:
Serial.println("WindowManager Init");


Getting my log functionality out of the loop, and I see nothing in the Micro Debug Trace, Com inspection window, or anywhere.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino struggles in debugging
Reply #6 - Apr 22nd, 2017 at 5:07pm
Print Post  
I think that is because you are not connected to the serial port.

Sounds like you should be using SerialUSB.println()

Visual Micro automatically detects which port which is why the debugger works. So your code just needs to the use the port that is connected via usb cable or have two cables.

« Last Edit: Apr 22nd, 2017 at 5:08pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
RonOhmer
Junior Member
**
Offline


Posts: 29
Joined: Feb 10th, 2015
Re: Arduino struggles in debugging
Reply #7 - Apr 22nd, 2017 at 5:08pm
Print Post  
Ah, ok, I did a test.   Yes, it does upload much faster on the Native Port.

THat being said, I do not see the serial.println on the native port, but I DO on the programming port.

So some happiness there Smiley

With a jtag cable is it possible to use GDB on the Due?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino struggles in debugging
Reply #8 - Apr 22nd, 2017 at 5:16pm
Print Post  
Serial.print is for programming port

SerialUSB.print is for native port.

Log.begin(LOG_LEVEL_VERBOSE, &SerialUSB);

Yes we can do gdb on the due, when you get jtag hooked up we can try some additional settings to use gdb
« Last Edit: Apr 22nd, 2017 at 5:17pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint