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.

MSP430FR2476: Best practices when when using LPM 3.5 via interrupt driven development

Part Number: MSP430FR2476
Other Parts Discussed in Thread: MSP430WARE

I was wondering what the best software tools and practices to use when using interrupt driven development. My program is currently set up to follow this basic path:

#include "driverlib.h"

//Global variables
#pragma PERSISTENT(hello)
int hello;

int main() {
    while(1) {}

}

/*
Interrupt routines below...
*/

How would I go about putting my micro into LPM3.5, and what are the best practices for handling that mode into and out of interrupt service routines.

Thanks!

  • I suggest you start with example msp430fr267x_LPM3_5_01.c here:

    dev.ti.com/.../node

    Read through it once (it's short), then read User Guide (SLAU445I) Sec 1.4.3 (particularly 1.4.3.1). 

    That example runs in LPM3.5 most of the time, waking up via an RTC interrupt, and blinks an LED by saving away the P1 configuration in backup memory (since the port config and SRAM are both lost).  The flow will give you an idea of how LPM3.5 works.

  • I see in the example code that the GPIO's configuration is stored in backup memory (BK_MEM). It looks really similar to what the ctpl tool does for storing peripheral state into FRAM in case of a device reset/switch to into LPM. I was hoping to make use of the FRAM utilities software that is included in MSP430Ware.

    In addition, I would like to use the driver library as well as it seems to greatly improve the legibility of the code and is overall easier for me to understand.

    Overall, do you think it's a good idea to a) use the ctpl library to put the microcontroller into LPMx.5 and b) use driverlib.h to configure the peripherals and simply initialize them at the start of main?

    Here's what I have in mind after looking into the example code:

    #include "driverlib.h"
    
    int main(void) {
    	initGPIO();
    	initRTC();
    	
    	while(1) {
    		ctpl_enterLpm35(CTPL_DISABLE_RESTORE_ON_RESET);
    	}
    }
    
    void initGPIO() {
    	//do some initialization
    }
    
    void initRTC() {
    	// do some initialization
    }
    
    
    // ISRs from here on out...
    #pragma vector=RTC_VECTOR
    __interrupt void RTC_ISR(void)
    {
    	// do something
    }

    Thanks!

  • (a) Yes, I think this is one of the intended uses for CTPL.

    (b) I see no obvious conflict with using driverlib along with CTPL.

**Attention** This is a public forum