Hi,
I am working on a project which needs to use low power mode to save power. I want my MCU to be in sleep (low power mode) for most of the time. The MCU should exit the sleep mode only when it detects a wake-up pulse on P2.1 pin. The wake-up pulse comes from a watch-dog receiver and it is 120 micro-second long. I have written a piece of code using the driverlib examples but that does not seem to be working fine. I am using MSP430F5229 and CCS v5. I use the MSP-FET430UIF to download and debug the code.
After I configure the specific ports, I enter an infinite while loop. Entering the loop I try to go to sleep mode using __bis_SR_register(LPM0 | GIE) and then wait for that wake-up signal. I have a break point right after the sleep mode mode on _no_operation(). The first time I run the code it does pass the sleep mode and stops on the breakpoint but after that it never pass the __bis_SR_register line of code. I have checked and confirmed the pulse at the input of micro-controller.
I hope that someone can help me out of this problem.
void main (void)
{
WDT_A_hold(WDT_A_BASE); //Stop watchdog timer
//Initialize GPIO // Port_wakeRX is defined as port 2 and pin_wakeRx is defined as GPIO_pin1 separately
GPIO_setAsInputPinWithPullUpresistor( PORT_WakeRx, PIN_WakeRx );
GPIO_enableInterrupt ( PORT_WakeRx, PIN_WakeRx );
GPIO_interruptEdgeSelect (PORT_WakeRx, PIN_WakeRx, GPIO_HIGH_TO_LOW_TRANSITION);
GPIO_clearInterruptFlag ( PORT_WakeRx, PIN_WakeRx );
while(1) {
__bis_SR_register(LPM0_bits | GIE);
__no_operation();
// Do some other stuff here after it wakes up
}
#pragma vector=PORT2_VECTOR
__interrupt void pushbutton_ISR (void)
{
switch(__even_in_range( P2IV, 10 )) {
case 0x00: break; // None
case 0x02: break; // Pin 0
case 0x04: // P2.1, WakeRx signal from AS3933
__bic_SR_register_on_exit(LPM0_bits);
break;
case 0x06:break;
case 0x08: break; // Pin 3
case 0x0A: break; // Pin 4
case 0x0C: break; // Pin 5
case 0x0E: break; // Pin 6
case 0x10: break; // Pin 7
default: _never_executed();
}
}