Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Arduino struggles in debugging (Read 836 times)
Visual Micro
Administrator
*****
Offline



Posts: 7979
United Kingdom
Re: Arduino struggles in debugging
Reply #8 - Apr 22nd, 2017 at 6:16pm
 
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
Back to top
« Last Edit: Apr 22nd, 2017 at 6:17pm by Visual Micro »  
WWW  
IP Logged
 
RonOhmer
Full Member
***
Offline



Posts: 20
Re: Arduino struggles in debugging
Reply #7 - Apr 22nd, 2017 at 6:08pm
 
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
 
Visual Micro
Administrator
*****
Offline



Posts: 7979
United Kingdom
Re: Arduino struggles in debugging
Reply #6 - Apr 22nd, 2017 at 6:07pm
 
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.

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



Posts: 20
Re: Arduino struggles in debugging
Reply #5 - Apr 22nd, 2017 at 5:58pm
 
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
 
Visual Micro
Administrator
*****
Offline



Posts: 7979
United Kingdom
Re: Arduino struggles in debugging
Reply #4 - Apr 22nd, 2017 at 1:59pm
 
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.




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



Posts: 20
Re: Arduino struggles in debugging
Reply #3 - Apr 22nd, 2017 at 4:25am
 
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.
Back to top
 

screen_001.PNG (103 KB | 30 )
screen_001.PNG
 
IP Logged
 
RonOhmer
Full Member
***
Offline



Posts: 20
Re: Arduino struggles in debugging
Reply #2 - Apr 21st, 2017 at 5:31pm
 
Yes, I meant Due.  Sorry about that.  I will try your suggestions and report back the results.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 7979
United Kingdom
Re: Arduino struggles in debugging
Reply #1 - Apr 21st, 2017 at 5:20pm
 
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
Full Member
***
Offline



Posts: 20
Arduino struggles in debugging
Apr 21st, 2017 at 4:57pm
 
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
 
Page Index Toggle Pages: 1
Send Topic Print