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.

MSP430FR5994: Not entering LPM3 (LMPx.5)!

Part Number: MSP430FR5994

Hello all,

I'm having a problem to get my MCU to go into LPM3 or lower ones.

I copied the code that TI provided as an example code for LPM3.5. (Code provided bellow)

When in standalone mode, MCU is disconnected completely from everything. Even the jumpers to the programmable part are disconnected.

In that case MCU is supplied by external source through 3.3V supply pin. On that line in serial the high resolution mutimeter is connected. (as an Ampermeter, resolution 1 nano Amper)

Current consuption is constantly around 2mA. (even though in LPM3.5 it shoud be way bellow 1 micro Amper)

So in this case the MCU either doesn't enter (most probably) LPM at all or there is something else.

Any help is appreciated.

Thank you.

#include <msp430.h>

void Board_Init(void);
void RTC_Init(void);
void EnterLPM35(void);
void WakeUpLPM35(void);

volatile unsigned i;

int main(void)
{
  WDTCTL = WDTPW | WDTHOLD;                 // Stop WDT

Board_Init();                           // Regular init code for GPIO and CS

  while(1)
  {

     

 
      EnterLPM35();                           // This function will NOT return.
  }
 // }
}

void Board_Init(void)
{
  // Port Configuration
  P1OUT = 0;
  P1DIR = 0xFF;

  P2OUT = 0;
  P2DIR = 0xFF;

  P3OUT = 0;
  P3DIR = 0xFF;

  P4OUT = 0;
  P4DIR = 0xFF;

  P5OUT = 0;
  P5DIR = 0xFF;

  P6OUT = 0;
  P6DIR = 0xFF;

  P7OUT = 0;
  P7DIR = 0xFF;

  P8OUT = 0;
  P8DIR = 0xFF;

  PJOUT = 0x00;
  PJSEL0 |= BIT4 | BIT5;
  PJDIR = 0xFFFF;

  // Disable the GPIO power-on default high-impedance mode to activate
  // previously configured port settings
  PM5CTL0 &= ~LOCKLPM5;

  // Setup Clocks
  CSCTL0_H = CSKEY >> 8;                    // Unlock CS registers
  CSCTL1 = DCOFSEL_0;                       // Set DCO to 1MHz
  CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK; // set ACLK = XT1; MCLK = DCO
  CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1;     // Set all dividers to 1
  CSCTL4 &= ~LFXTOFF;                       // Enable LFXT1
  do
  {
    CSCTL5 &= ~LFXTOFFG;                    // Clear XT1 fault flag
    SFRIFG1 &= ~OFIFG;
  } while (SFRIFG1 & OFIFG);                // Test oscillator fault flag
  CSCTL0_H = 0;                             // Lock CS registers
}

void EnterLPM35(void)
{
  PMMCTL0_H = PMMPW_H;                      // Open PMM Registers for write
  PMMCTL0_L |= PMMREGOFF;                   // and set PMMREGOFF

  // Enter LPM3.5 mode with interrupts enabled. Note that this operation does
  // not return. The LPM3.5 will exit through a RESET event, resulting in a
  // re-start of the code.
  __bis_SR_register(LPM3_bits | GIE);
}

void WakeUpLPM35(void)
{
  // Restore Port settings
  P1OUT = 0x00;
  P1DIR = 0xFF;
  P2OUT = 0x00;
  P2DIR = 0xFF;
  P3OUT = 0x00;
  P3DIR = 0xFF;
  P4OUT = 0x00;
  P4DIR = 0xFF;
  PJOUT = 0x00;
  PJSEL0 |= BIT4 | BIT5;
  PJDIR = 0xFFFF;

  // Reconfig/start RTC
  RTCCTL0_H = RTCKEY_H;                     // Unlock RTC key protected registers
  RTCCTL0_L |= RTCTEVIE;                    // enable RTC event interrupt for each minute
  RTCCTL1 = RTCBCD | RTCHOLD | RTCTEV__MIN; // BCD mode, RTC hold
  RTCCTL1 &= ~RTCHOLD;
  RTCCTL0_H = 0;                            // Lock RTC key protected registers

  // Disable the GPIO power-on default high-impedance mode to activate
  // previously configured port settings. This will also re-activate the RTC
  // settings.
  PM5CTL0 &= ~LOCKLPM5;

  // Restore Clocks so that RTC will be read
  CSCTL0_H = CSKEY >> 8;                    // Unlock CS registers
  CSCTL1 = DCOFSEL_0;                       // Set DCO to 1MHz
  CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK; // Set ACLK = XT1; MCLK = DCO
  CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1;     // Set all dividers to 1
  CSCTL4 &= ~LFXTOFF;                       // Enable LFXT1
  do
  {
    CSCTL5 &= ~LFXTOFFG;                    // Clear XT1 fault flag
    SFRIFG1 &= ~OFIFG;
  }while (SFRIFG1&OFIFG);                   // Test oscillator fault flag
  CSCTL0_H = 0;                             // Lock CS registers
}

  • Hi,

    A few questions to debug this:

    • Are you using an MSP430FR5994 LaunchPad? Or are you using another board?
    • Could you please also measure the current draw with your setup using active mode, and also LPM3 (not LPM3.5)? This will help determine if the issue is going into LPM3.5, or if it is something else.

    Additionally, since you are trying to reach the current levels in the datasheet, I would suggest you use Vcc = 3.0V to be consistent when debugging these power numbers.

    Regards,

    Nathan

  •  Hi Nathan,

    1. Yes, am using MSP430FR5994 Launchpad.

    2. Current draw in active mode (16 MHz) is around 2.3 mA. LPM3 mode (LPM 3.5 is only slightly different in system setup) also around 2.3 mA. (Vcc = 3.3V) That is why I think the MCU doesn't enter LPM at all. Even though system is correctly configured, and there is a command to enter into LPM mode.

    I don't expect to get the results as in specification, but these that I am getting are simply way off those stated in specification.

    Best regards,

    Sladjan

  • Hi Sladjan,

    When I try running your code I measure about 0.2 mA, so I am wondering if there is something different with your setup that is causing this higher measurement. To clarify, all jumpers are removed from the LaunchPad, and you are using a DMM in series with the power supply on the 3v3 pin, correct? Also, just to check, have you made any hardware changes to the LaunchPad?

    Either way, I agree that these numbers are much higher than they should be. The first thing to do to debug this is to determine if the device is really going into LPM3.5. First, pause the debugger while in the while(1) loop (after the EnterLPM35 call), and please check the PMMCTL0 register, and make sure that bit 4 (PMMREGOFF) is set. This means that the system enters LPMx.5. Next please verify that the device has gone into LPM3 by making sure that the following bits are set in the status register:
    #define CPUOFF (0x0010)
    #define SCG0 (0x0040)
    #define SCG1 (0x0080)

    If these registers are all set correctly, then the device is in LPM3.5, and something else is unexpectedly drawing power.

    Regards,
    Nathan
  • Hi Nathan,

    Yes all jumpers are removed from the board during the measurment, and yes DMM is in series on power supply pin (3.3V).

    No, there were not any changes made to the LaunchPad.

    The situation with the registers when I pause it in debuger is like this:

    PMMREGOFF = 0,

    CPUOFF = 1,

    SCG0 = 1,

    SCG1 = 1.

    When I try to set PMMREGOFF manually before the instruction to go to LPM3.5 (__bis_SR_register(LPM3_bits | GIE);) then the program gets stuck there.

    But either way he should do that by his own when he gets the instruction to go into LPM3.5.

    Interesting thing is when I use the debugger he is always at the line __bis_SR_register(LPM3_bits | GIE);

    Setting the break point after it or trying to use STEP OVER in debugger doesn't work.

    But as it seems most of the bits are good set. Only PMMREGOFF is not.

    Best regards,

    Sladjan

  • Hi Nathan,

    Yes all jumpers are removed from the board during the measurment, and yes DMM is in series on power supply pin (3.3V).

    No, there were not any changes made to the LaunchPad.

    The situation with the registers when I pause it in debuger is like this:

    PMMREGOFF = 0,

    CPUOFF = 1,

    SCG0 = 1,

    SCG1 = 1.

    When I try to set PMMREGOFF manually before the instruction to go to LPM3.5 (__bis_SR_register(LPM3_bits | GIE);) then the program gets stuck there.

    But either way he should do that by his own when he gets the instruction to go into LPM3.5.

    Interesting thing is when I use the debugger he is always at the line __bis_SR_register(LPM3_bits | GIE);

    Setting the break point after it or trying to use STEP OVER in debugger doesn't work.

    But as it seems most of the bits are good set. Only PMMREGOFF is not.

    Best regards,

    Sladjan

  • Hi Sladjan,

    The reason you are seeing the debugger always at the line that sets the LPM3 bits is that once the device goes into LPM3 the CPU will be turned off, so you will not be seeing any code execute until the CPU is woken up from an interrupt (you do not have any in your current code). So that is expected behavior.

    Please see here another thread where the user was seeing about 2 mA from the MSP430FR5994 when in LPM3: e2e.ti.com/.../542922

    I ran your code with the power analyzer mentioned in that post, and I also saw about 700 nA. Is your multimeter rated for hundreds of nanamps? Even if your resolution is good enough, if the DMM cannot measure current low enough it will not be accurate. Because you are seeing a similar measurement to what you saw in active mode, I suspect this is your issue.

    Regards,
    Nathan

**Attention** This is a public forum