Hi,
I am having troubles with visual micro debugger on Visual Studio 7 and latest VM beta plug-in.
I am used to write low level code for Atmel and debug through debugwire tools (JTAG ICE-mk2) but some time ago I discovered your nice sw debugger and I must say I like it.
Unfortunately, debugging a small code to manage a rotary encoder push button, I have seen unexpected behaviour with VM debugger.
I used Arduino MEGA and SER3 for debugging (115.2kbps) to avoid mixing up data on a single serial.
I have uploaded a small program and placed 2 breakpoints. One breakpoint is in an interrupt routine and one in the main loop.
If I enable only one of the two interrupt everything is working fne independently from which breakpoint is active.
No problems also when the two breakpoints are active but the conditions of each breakpoint prevent the possibility that both breakpoints are validated within a short time...
As soon as the second breakpoints occurs within a short time (some microsends) from the first the program in Arduino MEGA suddenly hangs; "continue execution" flag is set on each breakpoint action.
extern "C" {
#include "init.h"
#include "mytimer1.h"
}
volatile unsigned char isr_encFlag = ENC_IDLE;
unsigned char enc_switchCnt = 0;
unsigned char wtdgCnt = 0;
unsigned char toggle = 0;
void setup()
{
Serial.begin(115200);
IO_Conf();
Timer1_Conf();
}
void loop()
{
if ((isr_encFlag & ENC_SW_MASK) == (ENC_SW_PENDING + ENC_SW_SHORT)) {
if (toggle) {
toggle = 0;
LED_LO;
}
else {
toggle = 1;
LED_HI;
}
noInterrupts();
isr_encFlag &= ~(ENC_SW_MASK);
interrupts();
}
}
ISR(TIMER1_COMPA_vect)
{
DEBUG_HI;
if(++wtdgCnt == CNT_WTDG) {
wtdgCnt = 0;
}
if (ENC_SW_SENSE) {
if (enc_switchCnt <= CNT_SW_LONG) {
if (enc_switchCnt == CNT_SW_SHORT) {
isr_encFlag &= ~(ENC_SW_MASK);
isr_encFlag |= (ENC_SW_SHORT + ENC_SW_WAITREL);
}
if (enc_switchCnt == CNT_SW_LONG) {
isr_encFlag &= ~(ENC_SW_MASK);
isr_encFlag |= (ENC_SW_PENDING + ENC_SW_LONG);
}
enc_switchCnt++;
}
}
else {
enc_switchCnt = 0;
if (isr_encFlag & ENC_SW_WAITREL) {
isr_encFlag &= ~(ENC_SW_WAITREL);
isr_encFlag |= (ENC_SW_PENDING);
}
}
DEBUG_LO;
}
Zip file of the project is included.
Any idea to solve the problem or to explain the behaviour?
Thanks in advance and regards.