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 Not uploading the code with debugger enabled (Read 6202 times)
Valentin Capaldi
Newbies
*
Offline


Posts: 2
Joined: Jun 26th, 2013
Not uploading the code with debugger enabled
Jun 26th, 2013 at 7:54pm
Print Post  
Hello, i have been using Arduino and Eclipse for a while until i have found your debugger tool, so i decided to test VS+VisualMicro and i have some issues with the debugger enabled.

I have an Arduino UNO board and i am using the Adafruit LPD8806 libraries together with the SPI library.

First of all i have found issues with the robot library (and i have fixed it deleting the Robot libraries as you said in one of the topics)

Second, i have the exactly same problem with the ISR than:
[url]http://www.visualmicro.com/forums/YaBB.pl?num=1358598602[/url]
In my case i have no errors or warnings during the compilation but i don't know if this can be causing my other problems.

Third, when i am in "Release Mode" and i press the green play button to compile and upload, everything works fine (compiling, uploading and running on the board), but when i enable the debugger (in release or debug mode) and i compile and upload, everything seems to compile and upload fine, but the program never starts running on the board (the strip is frozen in the last color before the last "upload").

With the debugger ENABLED the COM port window shows:
[quote]
Port open
Port closed
Uploading to I/O board
Port open
[/quote]

The debug trace window:
[quote]
Program Started 'InterruptsTest' Version 1
[/quote]

The MicroBuild results window:
[quote]
Compiling 'InterruptsTest' for 'Arduino Uno'
Binary sketch size: 3886 bytes (12% of a 32256 byte maximum) (0,35 secs)
Compiling debug version of 'InterruptsTest' for 'Arduino Uno'
Binary sketch size: 5696 bytes (18% of a 32256 byte maximum) (0,62 secs)
Uploading to I/O board using 'COM3'
Done uploading
[/quote]


With the debugger DISABLED the COM window shows:
[quote]
Port closed
Uploading to I/O board
Port open
[/quote]

The MicroBuild results window:
[quote]
Compiling 'InterruptsTest' for 'Arduino Uno'
Binary sketch size: 3886 bytes (12% of a 32256 byte maximum) (0,38 secs)
Uploading to I/O board using 'COM3'
Done uploading
[/quote]


A simplified version of code is:
[code]
#include <SPI.h>
#include <LPD8806.h>

int nLEDs = 8;
LPD8806 strip = LPD8806(nLEDs);

const int effect_Pin = 32;
const int speedUP_Pin = 11;
const int speedDOWN_Pin = 13;

bool Effect_Button_State = LOW;
bool SpeedUP_Button_State = LOW;
bool SpeedDOWN_Button_State = LOW;
int Effect = 0;
int speed = 200;

unsigned long button_time = 0;
unsigned long last_button_time = 0;

void InitialiseInterrupt(){
  cli();
  PCICR = 0xFF;
  PCMSK2 = 0xFF;
  PCMSK1 = 0xFF;
  PCMSK0 = 0xFF;
  sei();
}

ISR(PCINT0_vect) {
     button_time = millis();
           if (button_time - last_button_time > 250) {
                 Effect++;
                 if (Effect > 7) {
                       Effect = 0;
                 }
                 last_button_time = button_time;
           }
}

void setup() {
     pinMode(effect_Pin, INPUT);
     digitalWrite(effect_Pin, LOW);
     pinMode(speedUP_Pin, INPUT);
     digitalWrite(speedUP_Pin, LOW);
     pinMode(speedDOWN_Pin, INPUT);
     digitalWrite(speedDOWN_Pin, LOW);

     InitialiseInterrupt();

     strip.begin();
     strip.show();
}
void colorChase(uint32_t c, uint8_t wait);
void colorWipe(uint32_t c, uint8_t wait);
void dither(uint32_t c, uint8_t wait);
void scanner(uint8_t r, uint8_t g, uint8_t b, uint8_t wait);
void wave(uint32_t c, int cycles, uint8_t wait);
void rainbowCycle(uint8_t wait);
uint32_t Wheel(uint16_t WheelPos);

void loop() {
   if ((Effect == 1) || (Effect == 7)) {
     colorWipe(strip.Color(127,127,127), speed); 
   }
   if ((Effect == 2) || (Effect == 7)) {
     colorWipe(strip.Color(127,0,0), speed);     // red
   }

  for (int i=0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, 0);
  }

}
[code]

Than you very much in advance.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Not uploading the code with debugger enabled
Reply #1 - Jun 26th, 2013 at 8:23pm
Print Post  
Hi,

Thanks for the information.

There are a few things that might cause this behavior and it is not clear exactly where your breakpoints are placed or with what conditions or hit count properties. 

So I'll give some information and ask a few questions to see if we can help.

1)
The default settings for the debugger are to use the hardware Serial system of Arduino at a speed of 115200. Serial relies on timer0 so the debugger will not work if you are unable to start the serial in your sketch code and print something. You can manually test to see if Serial will work in your sketch as follows:-

Code
Select All
void setup()
{
 Serial.begin(115200);
}

void loop()
{
  Serial.println("Arduino has serial");
} 



2)
Breakpoints can only be placed in code that would normally allow Serial or SoftwareSerial to be used.

3)
If breakpoints are placed in timer callback methods then the project property called ThrottleEnabled must be set to False. In this case it is important to ensure that frequently executing TracePoints (non breaking BreakPoints) are limited to a rate of 10Hz or less. 
You can limit the rate by setting the Breakpoint "HitCounter" property to a Millis value such as 250 (4hz) or by adding an expression to the Breakpoint "Condition". 

That's all there is to it. During debug compile the debugger injects serial.print statements into a temp copy of the sources. Depending on breakpoint and project settings, the debugger also declares a few global variables to track when a breakpoint last executed and/or the last value of a breakpoint condition.

After we solve this problem, the first part of the following video can be ignored but it might be useful to watch how to more easily configure the debug properties and hear about alternative transports to the default "Hardware Serial". http://www.youtube.com/watch?v=fFM8_RhIG0U

  
Back to top
IP Logged
 
Valentin Capaldi
Newbies
*
Offline


Posts: 2
Joined: Jun 26th, 2013
Re: Not uploading the code with debugger enabled
Reply #2 - Jun 27th, 2013 at 2:18pm
Print Post  
Dear Tim, 

I have solved the issue, the key to do it was:

Quote:


3)
If breakpoints are placed in timer callback methods then the project property called ThrottleEnabled must be set to False. In this case it is important to ensure that frequently executing TracePoints (non breaking BreakPoints) are limited to a rate of 10Hz or less.
You can limit the rate by setting the Breakpoint "HitCounter" property to a Millis value such as 250 (4hz) or by adding an expression to the Breakpoint "Condition"


I had 3 breakpoints with the "when hit" option set over the ISR(PCINTX_vect){ line. I was trying to figure out which PCINT vector was called. I have changed the tracing method, I have removed the breakpoints in the ISR and now everything is working perfect!.

One more thing, i have read that a second email with some "beginner tutorial" or explanations should arrive to my email inbox after signing in. Is that right? because i haven't received it.

Thank you very much for your help and congratulations for your work, the add-on is very helpful and saves me a lot of debugging time!

Thank you very much

best regards.
« Last Edit: Jun 27th, 2013 at 2:23pm by Valentin Capaldi »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Not uploading the code with debugger enabled
Reply #3 - Jun 27th, 2013 at 2:27pm
Print Post  
Great news, thanks for the update. 

The debug docs have changed slightly over time. Right now there are a number on the wiki on visualmicro.com, also the debug page gives some info and the youtube video. You might be past the youtube video but the wiki might be of most help

http://www.visualmicro.com/post/2012/05/05/Debug-Arduino-Overview.aspx
http://www.visualmicro.com/archive.aspx
http://www.youtube.com/watch?v=fFM8_RhIG0U

We are just finishing the Arduino 1.5.3 work + support for other micro controllers such as Texas Instruments. Then we hope to invest more time in documentation and tutorials.

Thanks again for the update

EDIT: For standard Arduino boards such as the mega2560, move all of the hardware libs to the ide/libraries folder.
« Last Edit: Jun 27th, 2013 at 2:52pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint