Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 

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 and Verbose
  • 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
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
The Plot Function and Breakpoints Slows Down MCU Process Speed?? (Read 1569 times)
KDawg
Junior Member
**
Offline



Posts: 10
The Plot Function and Breakpoints Slows Down MCU Process Speed??
Dec 2nd, 2021 at 2:37am
 
I was playing around with the @Plot functions on the Arduino Pro Micro (Leonardo) with the MPU6050 breakout board. I modified the example code from the Adafruit MPU6050 library to plot the 3 axis of acceleration and 3 axis of gyro data as well as the temperature. Rather than the Serial Print, I decided to plot the 7 datas into 3 separate @Plot graphs and removed any delay functions.

Running the code, I noticed the graphs responds very slowly to changes in the orientation of the MPU6050. Sometimes over 15 seconds! When I changed the graph settings to obtain the data whenever it's available, it still had that problem.

When I removed the @Plot function and went back to Serial.Println(), it had the instant response to my inputs again.

So my question is how does the @plot function and breakpoints work? Do they add extra lines of code to the Arduino during compile and upload? And how does this tax the MCU's processing speed?
Back to top
 
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline



Posts: 11542
United Kingdom
Re: The Plot Function and Breakpoints Slows Down MCU Process Speed??
Reply #1 - Dec 2nd, 2021 at 3:14am
 
Did you try switching on full speed debugging on the vmicro debugger menu?
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline



Posts: 11542
United Kingdom
Re: The Plot Function and Breakpoints Slows Down MCU Process Speed??
Reply #2 - Dec 2nd, 2021 at 3:21am
 
Plus. The overhead of processing plot means that fast loops should be considered carefully. The hit count on breakpoints is a millis counter.

Any changes to full speed or breakpoints need reupload
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
KDawg
Junior Member
**
Offline



Posts: 10
Re: The Plot Function and Breakpoints Slows Down MCU Process Speed??
Reply #3 - Dec 2nd, 2021 at 4:54am
 
Tim@Visual Micro wrote on Dec 2nd, 2021 at 3:14am:
Did you try switching on full speed debugging on the vmicro debugger menu?


I just read up on debug speed. If I got it correctly, it's left on at default at a baud rate of 115200 in the project setting.
Back to top
 
 
IP Logged
 
KDawg
Junior Member
**
Offline



Posts: 10
Re: The Plot Function and Breakpoints Slows Down MCU Process Speed??
Reply #4 - Dec 2nd, 2021 at 5:01am
 
I'm still learning more about the debug functions of VM. I tried to print out my fast changing 12 bit PWM value input to a DC motor controller on my Raspberry Pi Pico. This slowed down my motor speed ramp up by A LOT.

When I added a condition and hit counter, this lag or slow response seems to have disappeared. I've attached a screenshot of my code and breakpoint.

Now I tried this with my MPU6050 but now it doesn't print anything.  Huh
Back to top
 

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



Posts: 1578
Re: The Plot Function and Breakpoints Slows Down MCU Process Speed??
Reply #5 - Dec 2nd, 2021 at 11:29am
 
Thanks for the detail.

Could you enable the vMicro > Compiler > Show Build Properties, and vMicro > Compiler > Verbose, and attach the full build output?

Please see the attached image which shows the vMicro > Debugger > Full Speed (No Throttle) option, which will remove the delays around the trace point.
Back to top
« Last Edit: Dec 2nd, 2021 at 11:29am by Simon@Visual Micro »  

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
KDawg
Junior Member
**
Offline



Posts: 10
Re: The Plot Function and Breakpoints Slows Down MCU Process Speed??
Reply #6 - Dec 3rd, 2021 at 2:53am
 
I clicked the Full Speed and ran it again. Still very slow response. Attached is a screenshot of the VM windows.

Also, I noticed the degree plot is not plotting anything at all now... Shocked

Back to top
« Last Edit: Dec 3rd, 2021 at 3:13am by KDawg »  

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
KDawg
Junior Member
**
Offline



Posts: 10
Re: The Plot Function and Breakpoints Slows Down MCU Process Speed??
Reply #7 - Dec 3rd, 2021 at 3:09am
 
Here is my debug setting
Back to top
« Last Edit: Dec 3rd, 2021 at 3:12am by KDawg »  

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
KDawg
Junior Member
**
Offline



Posts: 10
Re: The Plot Function and Breakpoints Slows Down MCU Process Speed??
Reply #8 - Dec 3rd, 2021 at 3:11am
 
I got the hit counter to work and the response seems to be faster but it's still quite slow and nowhere near being instant reaction to my inputs
Back to top
 

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



Posts: 1578
Re: The Plot Function and Breakpoints Slows Down MCU Process Speed??
Reply #9 - Dec 3rd, 2021 at 10:24am
 
Thanks for the update.

If the hitCounter is still configured as Milliseconds this will only output data every 250ms from the condition shown, or every 250 times past the point if set to Counter.  Reducing this should improve the speed. More information below:
https://www.visualmicro.com/page/User-Guide.aspx?doc=Working-With-Breakpoints-Hi...

Also it will be more efficient to send the data back in a single tracepoint, as you are with the direct serial.print code.
e.g. Add a single tracepoint on the tempC line which contains all information for the trace/plot, with the Action being set like below:
Code:
{@Plot.Gyro.A ax}{@Plot.Gyro.B ay}{@Plot.Gyro.C az}{@Plot.Acceleration.A gx}{@Plot.Acceleration.B gy}{@Plot.Acceleration.C gz}{@Plot.Temperature.deg tempC} 



The condition of millis() > 1 can also be removed as this will always be true.

Does this help to improve the reaction speed?
Back to top
 
 
IP Logged
 
KDawg
Junior Member
**
Offline



Posts: 10
Re: The Plot Function and Breakpoints Slows Down MCU Process Speed??
Reply #10 - Dec 10th, 2021 at 9:23pm
 
Sorry for the late response as I had a work trip. I tried your methods and the graph does seem to be responsive now.

I had the hit counter set to milliseconds. Setting it to multiples of 100 still seems to have that lag issue. Initially setting it to 250 or 200, the code seems to get stuck and not run at all when I hit upload. Setting it to 500, the graphs seems to be quick to respond to my inputs. I tried again with the 250 and now it works which is very weird.
Back to top
 

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print