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) Debugger stops after random time (Read 8138 times)
Chris Molloy
Junior Member
**
Offline


Posts: 54
Location: Ontario, Canada
Joined: Dec 13th, 2012
Debugger stops after random time
Jul 2nd, 2014 at 12:33pm
Print Post  
I am debugging an arduino sketch.  Debugging was working, but something changed and now it just stops at random times.

If I run without debugging it runs fine.  I have an led blinking to indicate running.

The debugger just stops running, the led stops blinking.

Other code works fine.  I have tried numerous different boards with same result.

Will post code later.

  
Back to top
 
IP Logged
 
Chris Molloy
Junior Member
**
Offline


Posts: 54
Location: Ontario, Canada
Joined: Dec 13th, 2012
Re: Debugger stops after random time
Reply #1 - Jul 2nd, 2014 at 12:34pm
Print Post  
The breakpoint is set to continue execution. And display a variable
  
Back to top
 
IP Logged
 
Chris Molloy
Junior Member
**
Offline


Posts: 54
Location: Ontario, Canada
Joined: Dec 13th, 2012
Re: Debugger stops after random time
Reply #2 - Jul 2nd, 2014 at 12:39pm
Print Post  
here is the code


This code creates a schedule for events every second, minute & hour 
*/

#include <Metro.h> //Include Metro library 

// Create metro objects and set intervals to one second, minute & hour
Metro Second = Metro(1000); //one second
Metro Minute = Metro(2000); //one minute
Metro Hour = Metro(4000); //one hour

#include "RunningAverage.h"

//Create running average objects
RunningAverage Sensor1Seconds(60);
RunningAverage Sensor1Minutes(60);
RunningAverage Sensor1Hours(24);
RunningAverage Sensor2Seconds(60);
RunningAverage Sensor2Minutes(60);
RunningAverage Sensor2Hours(24);
RunningAverage Sensor3Seconds(60);
RunningAverage Sensor3Minutes(60);
RunningAverage Sensor3Hours(24);
RunningAverage Sensor4Seconds(60);
RunningAverage Sensor4Minutes(60);
RunningAverage Sensor4Hours(24);
RunningAverage Sensor5Seconds(60);
RunningAverage Sensor5Minutes(60);
RunningAverage Sensor5Hours(24);


//variables to track time elapsed
int seconds = 0;
int minutes = 0;
int hours = 0;

void setup()
{
     Sensor1Seconds.clear();
     Sensor1Minutes.clear();
     Sensor1Hours.clear();
     Sensor2Seconds.clear();
     Sensor2Minutes.clear();
     Sensor2Hours.clear();
     Sensor3Seconds.clear();
     Sensor3Minutes.clear();
     Sensor3Hours.clear();
     Sensor4Seconds.clear();
     Sensor4Minutes.clear();
     Sensor4Hours.clear();
     Sensor5Seconds.clear();
     Sensor5Minutes.clear();
     Sensor5Hours.clear();
}

float s1=0;
float s2=0;
float s3=0;
float s4=0;
float s5=0;
float m1=0;
float m2=0;
float m3=0;
float m4=0;
float m5=0;
float h1=0;
float h2=0;
float h3=0;
float h4=0;
float h5=0;
float rn;

void SensorSecondUpdate() {
           rn = random(0, 1000);
        Sensor1Seconds.addValue(rn);
           s1 = Sensor1Seconds.getAverage();
           rn = random(0, 1000);
        Sensor2Seconds.addValue(rn);
           s2 = Sensor2Seconds.getAverage();
           rn = random(0, 1000);
        Sensor3Seconds.addValue(rn);
           s3 = Sensor3Seconds.getAverage();
           rn = random(0, 1000);
        Sensor4Seconds.addValue(rn);
           s4 = Sensor4Seconds.getAverage();
           rn = random(0, 1000);
        Sensor5Seconds.addValue(rn);
           s5 = Sensor5Seconds.getAverage();

}

void SensorMinuteUpdate() {
           float x = Sensor1Seconds.getAverage();
           Sensor1Minutes.addValue(x);
           m1 = Sensor1Minutes.getAverage();
           Sensor1Seconds.clear();
           x = Sensor2Seconds.getAverage();
           Sensor2Minutes.addValue(x);
           m2 = Sensor2Minutes.getAverage();
           Sensor2Seconds.clear();
           x=Sensor3Seconds.getAverage();
           Sensor3Minutes.addValue(x);
           m3 = Sensor3Minutes.getAverage();
           Sensor3Seconds.clear();
           x = Sensor4Seconds.getAverage();
           Sensor4Minutes.addValue(x);
           m4 = Sensor4Minutes.getAverage();
           Sensor4Seconds.clear();
           x=Sensor5Seconds.getAverage();
           Sensor5Minutes.addValue(x);
           m5 = Sensor5Minutes.getAverage();
           Sensor5Seconds.clear();
}

void SensorHourUpdate() {
           float x=Sensor1Minutes.getAverage();
           Sensor1Hours.addValue(x);
           h1 = Sensor1Hours.getAverage();
           x=Sensor2Minutes.getAverage();
           Sensor2Hours.addValue(x);
           h2 = Sensor2Hours.getAverage();
           x=Sensor3Minutes.getAverage();
           Sensor3Hours.addValue(x);
           h3 = Sensor3Hours.getAverage();
           x=Sensor4Minutes.getAverage();
           Sensor4Hours.addValue(x);
           h4 = Sensor4Hours.getAverage();
           x=Sensor5Minutes.getAverage();
           Sensor5Hours.addValue(x);
           h5 = Sensor5Hours.getAverage();
}

void loop()
{

  if (Second.check() == 1) { // check if its been a second
           seconds = ++seconds;
           SensorSecondUpdate();
     //put stuff here to do every second
  }

    if (Minute.check() == 1) { // check if its been a minute
           minutes = ++minutes;
           SensorMinuteUpdate();
           //put stuff here to do every minute
  }
      
     if (Hour.check() == 1) { // check if its been an hour
           hours = ++hours;
           SensorHourUpdate();

           //put stuff here to do every hour
  }

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


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugger stops after random time
Reply #3 - Jul 2nd, 2014 at 12:45pm
Print Post  
Hi Chris,

The debugger uses serial.print so if this happens it normally means the Arduino is crashing on some data the serial doesn't like.

Please switch on "tools>options>visual micro>compiler>show build folder" then run the debug compile and upload. After that the "Micro Build" output window will contain a link to the temp build folder. CTRL+Click the link will open the folder then please email the sketchname.cpp to info[at]visualmicro.com

This will show us your message, other debug settings and where the breakpoint(s) have been positioned.

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


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugger stops after random time
Reply #4 - Jul 2nd, 2014 at 8:57pm
Print Post  
Hi Chris,

Thanks for the cpp code.

Would you please close the Ide and ensure you click save changes. This will ensure your breakpoints are saved to the Atmel/Visual Studio .sln file which is hopefully in the sketch folder.

Then zip the entire sketch folder along with the .VisualMicro sub folder and email to me please

Thanks
  
Back to top
IP Logged
 
Chris Molloy
Junior Member
**
Offline


Posts: 54
Location: Ontario, Canada
Joined: Dec 13th, 2012
Re: Debugger stops after random time
Reply #5 - Jul 2nd, 2014 at 11:59pm
Print Post  
Just so you know, it does not seem to matter where I put break point or what variables are displayed.  s1 was the one getting an ovf value and some others got another if? Error. Dont rember last letter
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugger stops after random time
Reply #6 - Jul 3rd, 2014 at 11:25am
Print Post  
This is what I see in your sketch. Not sure what is supposed to happen here...

  

Please Register or Login to the Forum to see File Attachments
Back to top
IP Logged
 
Chris Molloy
Junior Member
**
Offline


Posts: 54
Location: Ontario, Canada
Joined: Dec 13th, 2012
Re: Debugger stops after random time
Reply #7 - Jul 3rd, 2014 at 12:28pm
Print Post  
If you trace s1, s2, s3, s4 & s5

You should get ovf values, and the arduino will eventually stop running.  Blink does not flash the led.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugger stops after random time
Reply #8 - Jul 3rd, 2014 at 12:48pm
Print Post  
None of the files you have provided show any tracing of the s1-s5 values

None of your breakpoints in the examples provided, do much other than report m or millis()

What you have provided is different to what you have posted above.

The debugger just uses the standard Arduino Serial.print() so I suspect that your code is printing a null or had not initialized a variable that is being used in a breakpoint message or condition.

Sorry to be so vague but time is short and I am having trouble establishing an example of any breakpoints that trace anything you have mentioned.

The only exception is that in the solution you sent me which has some breakpoints that do not do much, you do have one disabled breakpoint which you have not allowed to be included in the compile. It has a when hit message of {seconds} {s1}

If {seconds} or {s1} is problem then you must look at the data types defined for these variables. The Arduino serial.print (which the debugger uses) will only fail and crash if the data is invalid.

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