Tool/software: Code Composer Studio
Have been trying to debug a simple example program for the MSP430F2274 device. The example uses timerA in continuous mode and toggles and LED when an interrupt occurs (a.k.a when TAIV = 10). Within the `interrupt void Timer_A(void)` function, I have set a breakpoint at a switch statement, which chooses the operation to be performed depending on the value of TAIV. When entering debug mode the program never stops at the breakpoint, making it appear that the interrupt is never reached. Upon viewing the register, I can confirm that an interrupt has occurred based upon the change in the TAIV register. Is it possible to have a breakpoint set in an interrupt function? If it is, could there be a reason as to why this it is never triggered during my debug session? If not, is there another method of debugging that confirms that the ISR is reached? Ideally, if the ISR can be stepped through it would be much more helpful for future project work using this device.
Furthermore, once the program is run from the debugger, the intended functionality is not happening until the device is disconnected and reconnected to a power source. The problem is that when disconnecting from the USB, the debugger stops working as it no longer has a device that it can reach for its debugging purposes. Is there a reason that this occurs, or is this common with all MSP430 devices? If not, are there any options which can be changed to allow the device to work correctly once the debugger has begun running, without having to disconnect/reconnect it?
CODE:
#include <msp430.h> int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT P1DIR |= 0x01; // P1.0 output TACTL = TASSEL_2 + MC_2 + TAIE; // SMCLK, contmode, interrupt __bis_SR_register(GIE); // Enter LPM0 w/ interrupt for (;;); } // Timer_A3 Interrupt Vector (TAIV) handler #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=TIMERA1_VECTOR __interrupt void Timer_A(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(TIMERA1_VECTOR))) Timer_A (void) #else #error Compiler not supported! #endif { switch(TAIV) // Efficient switch-implementation { case 2: break; // TACCR1 not used case 4: break; // TACCR2 not used case 10: P1OUT ^= 0x01; // overflow break; } }