Hi all!
I continue understanding low power consumption :-)
I got an strange behavior (that I do not understand) using TimerA0 if I previously setup P2.
#include <msp430.h> void main ( void ) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR = 0xFF; P1SEL = 0; P1REN = 0xFF; P1OUT = 0; P2DIR = 0xFF; P2SEL = 0; P2REN = 0xFF; P2OUT = 0; P3DIR = 0xFF; P3SEL = 0; P3REN = 0xFF; P3OUT = 0; P1IE = 0; P1IES = 0; P1IFG = 0; P2IE = 0; P2IES = 0; P2IFG = 0; CACTL1=0; //turn off comparator CACTL2=0; ADC10CTL0=0; //turn off ADC10 ADC10CTL1=0; UCB0CTL0=0; //turn off USCI_B0_SPI UCB0CTL1=0; BCSCTL1 |= DIVA_3; // Divide by 8 BCSCTL3 |= XCAP_3; // Select 12pF caps // P1DIR |= 0x01; // Set P1.0 to output direction TA0CCR0 = 5000; TA0CTL = TASSEL_1+ ID_3 + MC_1; // ACLK, upmode TA0CCTL0 |= CCIE; // enable TA0CCRO interrupt __bis_SR_register(GIE); while(1) { P1OUT ^= 0x01; // do any other needed items in loop __bis_SR_register(LPM3_bits); // enter LPM3, clock will be updated } } // Timer A0 interrupt service routine #pragma vector=TIMER0_A0_VECTOR __interrupt void Timer_A (void) { TA0CCR0 = 5000; // incrementSeconds(); __bic_SR_register_on_exit(LPM3_bits); }
The Timer_A is not triggered with the code above. However, commenting P2 related set-up, Timer_A is triggered!. I expect to be under 1uA when in LPM3. Just commenting P1OUT^=0x01 (to toggle the LED at P1.0 in the launchpad) and TA0 related setup I got it. I cannot understand what is happening here. When P2 is setup, code keeps on line __bis_SR_register(LPM3_bits) in the debugger.
Any idea about what is happening and how to solve it? Thanks in advance!