I have an application that I want to boot into LPM3 with P1.1 enabled as a switch....Upon pushing this switch I want a PWM to operate AND I enable the RTC at once per second. I exit P1 interrupt still sleeping. The hope is that after 100 seconds a counter in the RTC recognizes this and puts the device into LPM3.5. Upon coming out of 3.5 I attempt to clear PMMREGOFF and force a brownout which puts me back at 'normal' mode. None of this seems to be happening correctly....The code below after pushing the button starts the PWM then after about 2 seconds of flashing the LED just stays on. I am finding it EXTREMELY difficult to work with this LPM3.5/RTC. I constantly am trying to pause the debugger to reboot but CCS will have non of it and tends to lock up. Can someone give me suggestions on both what I am doing wrong in the code as well as why CCS keeps wanting to lock up? BTW. The RTC #2 program under this part and resource explorer does similar. I've cut and pasted it just changing the IO to my IO and CCS still wanders off. I have loaded the RTC #1 program onto the board and it works fine (every second it just toggles the IO in the RTC).
I would ultimately like to go into LPM3 after the PWM is over (my understanding is PWM won't work below LPM3) and reboot to a state of just very low power ie 3.5 until someone pushes the button again.
Thanks
CCS when pause is pushed responds with:
MSP430: Trouble Halting Target CPU: Internal error
#include <msp430.h> #include "funct.h" volatile unsigned int count; volatile unsigned int flag = 0; int main(void) { WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer //small macro to flash LED to show a reset has occured. configGPIO(); PM5CTL0 &= ~LOCKLPM5; __delay_cycles(80000); P1OUT &= ~BIT4; configACLK(); if (SYSRSTIV == SYSRSTIV_LPM5WU) { //wake up from LPM3.5? flag = 0; configGPIO(); PMMCTL0 = PMMPW; PMMCTL0 &= ~PMMREGOFF; //clear LPM3.5 bit PMMCTL0 |= PMMSWBOR; // force reboot to normal } else { //no? __bis_SR_register(LPM3_bits + GIE); //LPM3.5 entry point } return 0; } #pragma vector = RTC_VECTOR __interrupt void thirtyMinuteCounter(void) { switch(__even_in_range(RTCIV, RTCIV_RTCIF)) { case RTCIV_NONE : break; // No interrupt pending case RTCIV_RTCIF: // RTC Overflow count++; if (count >= 100) { count = 0; PMMCTL0 = PMMPW; // Open PMM Registers for write PMMCTL0_L |= PMMREGOFF; //sets LPM3.5 } break; default: break; } } #pragma vector = PORT1_VECTOR __interrupt void ifNonLPM3_5(void) { switch (__even_in_range(P1IV, 4)) { case 4: //P1.1 configTA0_PWM(16384, 4); //3276 configRTC(33); //1800 break; default: break; } }