This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR2110: how to exit LPM0/LPRM3 when

Part Number: MSP430FR2110

I am using the MSP430FR2110. 

I want MSP430FR2110 to exit LPM3/LPM0 when RTC interrupt is triggered and enter LPM3/LPM0 otherwise. However, RTC clock interrupt stops after short period of time. am I not using the enter and exit LPM correctly (highlighted portion of the code)?

Details regarding my application (code below), MSP430FR2110 send data throught spi when RTC interrupt is triggered. MSP430FR2110 should enter LPM3/LPM0 until next RTC interrupt event.

#include <msp430.h> volatile static uint16_t pir_data[NUMBER_OF_CHANNELS]; int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer // set MCLK (CPU clock) to 3 MHz // DCOFTRIM=3, DCO Range = 8MHz CSCTL1 = DCORSEL_3; // use default setting: digitally controller oscillator (DCO) as MCLK and SMCLK clock source // set default REFO(~32768Hz) as ACLK source CSCTL4 = SELMS__DCOCLKDIV | SELA__REFOCLK; PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode // to activate previously configured port settings // RTC count RTCMOD = 320-1; // Initialize RTC // Source = ACLK = REFO SYSCFG2 |= RTCCKSEL; // Select ACLK as RTC clock RTCCTL = RTCSS_1 | RTCSR | RTCPS__1 | RTCIE; while(1); } // RTC interrupt service routine #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=RTC_VECTOR __interrupt void RTC_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(RTC_VECTOR))) RTC_ISR (void) #else #error Compiler not supported! #endif { switch(__even_in_range(RTCIV,RTCIV_RTCIF)) { case RTCIV_NONE: break; // No interrupt case RTCIV_RTCIF: // RTC Overflow __bic_SR_register_on_exit(LPM3_bits); __bis_SR_register(GIE); serial_interface_send_pir_data(pir_data); __bis_SR_register(LPM3_bits); break; default: break; } }


  • What's happening here is that the RTC ISR halts (halfway through) until the next (RTC) interrupt calls it again (recursively). This happens (32768/1/320=~100) times per second, each time eating up some more stack, until the stack overflows.

    I (strongly) recommend you not set either GIE nor LPM3_bits in an ISR. It's also rarely a good idea to call from an ISR into another device driver.

    Instead, set a flag, do the wakeup ("...on_exit") and return, and let main call the serial_interface.

**Attention** This is a public forum