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.

MSP430 Active Vs LPM Current Measurement

The original customer question:

We mounted an MSP430F5324IRGC on [a custom] breakout board, tried to load and run some very simple code, and found the current draw was excessive.

In a version of the code which just goes to low_power_mode_3, current draw was 0.5mA  (would expect closer to 2 uA from datasheet); and in a version of code which just goes to a while(1) current draw was 70 mA.

While the "while(1)" version was running, I also tried grounding the nRST pin.  This did not decrease the current draw, and after a moment, current actually increased, and it now sits at approx 80 mA (either with or without nRST pulled low).

  • Executing out of a while (1) will not give a realistic measurement of power consumption. When testing for a baseline of power consumption three tests should be implemented to properly measure current draw.

    1. while(1) as you have done.
    2. while(1) + NOP
    3. while(1) with .asm designed specifically for measuring average current. This is what the MSP430 factory applications team uses to characterize current draw in our datasheets.

    You can also find this .asm code in the MSP430 One-Day Workshop material on page 43 of the following document.

    MSP430 One-Day Workshop: http://software-dl.ti.com/trainingTTO/trainingTTO_public_sw/MSP430_5xx_One_Day_Workshop/MSP430F5xx_One_Day_Workshop_v1-2.pdf#page=43

    Please reference the following source file for measuring current draw in active mode (3 methods) and LPM3.

    //******************************************************************************
    //   MSP430F532x Demo - Enters LPM3 with ACLK = LFXT1, REF0 disabled, 
    //                      VUSB LDO and SLDO disabled, SVS disabled
    //
    //   Description: Configure ACLK = LFXT1 and enters mode defined by 
    //   POWER_TEST_MODE. Measure current.
    //   ACLK = LFXT1 = 32kHz, MCLK = SMCLK = default DCO 
    //
    //                MSP430F532x
    //             -----------------
    //        /|\ |              XIN|-
    //         |  |                 | 32kHz
    //         ---|RST          XOUT|-
    //            |                 |
    //
    //   B. Nisarga
    //   Texas Instruments Inc.
    //   Modified by E. Macias/A.Miller Feb 2012
    //   Built with CCSv4.2 and IAR Embedded Workbench Version: 5.4
    //******************************************************************************
    #include <msp430f5328.h>
    
    //
    // POWER_TEST_MODE: 1. For LPM3 
    //                  2. For active mode using while(1);
    //                  3. For acitve mode using while(1){NOP;}
    //                  4. For active mode using .asm (this is the true average)
    //
    #define POWER_TEST_MODE		4				// LPM3			
    
    typedef enum
    {
        LPM3_MODE = 1,
        WHILE_1_MODE,
        WHILE_1_NOP_MODE,
        AVERAGE_CURRENT_MODE
    } tCurrentMeasurement;
    
    
    void main(void)
    {
      WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer  
    
      // Enable XT1
      P5SEL |= BIT4+BIT5;                       // Port select XT1
      UCSCTL6 &= ~(XT1OFF);                     // XT1 On
      UCSCTL6 |= XCAP_3;                        // Internal load cap
    
      // Loop until XT1 & DCO stabilizes
      do
      {
        UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG);
                                                // Clear XT2,XT1,DCO fault flags
        SFRIFG1 &= ~OFIFG;                      // Clear fault flags
      }while (SFRIFG1&OFIFG);                   // Test oscillator fault flag
    
      UCSCTL6 &= ~(XT1DRIVE_3);                 // Xtal is now stable, reduce drive
                                                // strength
      // Port Configuration
      P1OUT = 0x00;P2OUT = 0x00;P3OUT = 0x00;P4OUT = 0x00;P5OUT = 0x00;P6OUT = 0x00;
      PJOUT = 0x00;
      P1DIR = 0xFF;P2DIR = 0xFF;P3DIR = 0xFF;P4DIR = 0xFF;P5DIR = 0xFF;P6DIR = 0xFF;
      PJDIR = 0xFF;
    
      // Disable SVS
      PMMCTL0_H = PMMPW_H;                // PMM Password
      SVSMHCTL &= ~(SVMHE+SVSHE);         // Disable High side SVS 
      SVSMLCTL &= ~(SVMLE+SVSLE);         // Disable Low side SVS
      
      switch (POWER_TEST_MODE)
      {
      
    	case LPM3_MODE:
    		//
    		// For testing LPM3 measure
    		//
    		__bis_SR_register(LPM3_bits);       // Enter LPM3
    	  
    		__no_operation();                   // For debugger
    		break;
    	case WHILE_1_MODE:
    		//
    		// For testing while(1) current consumption
    		//
    		while(1);
    		break;
    	case WHILE_1_NOP_MODE:
    		//
    		// For testing while(1) + NOP current consumption
    		//
    		while(1)
    		{
    			__no_operation();
    		}
    		break;
    	case AVERAGE_CURRENT_MODE:
    		//
    		// For testing average current consumption
    		//
    		asm ("ACTIVE_MODE_TEST: MOV     #0x2000, R4  \n"
    		   "                  MOV     #0x4, 0(R4)  \n"
    		   "                  MOV     &0x2000, &0x2002  \n"
    		   "                  ADD     @R4, 2(R4)      \n"
    		   "                  SWPB    @R4+            \n"
    		   "                  MOV     @R4, R5         \n"
    		   "IDD_AM_L1:        XOR     @R4+, &0x2020   \n"
    		   "                  DEC     R5             \n"
    		   "                  JNZ     IDD_AM_L1      \n"
    		   "                  JMP     ACTIVE_MODE_TEST ");
    		break;
    	default:
    		break;
    	}
    }
    
    

    Also the main reason that you are observing high current is because the pins are being left as inputs and are not being pulled high or low.

    Any noise that is picked up by the pins will cause the CMOS to switch between high and low, increasing power consumption.

    The pins for characterizing current draw need to be set out as outputs and either pulled high or low. Make sure that any external connection to the MSP430 which is supposed to be an input, gets modified in the example code attached. At the moment all the pins in the MSP430 are set as output and driven low.

    When measuring current consumption utilizing while(1) and while(1) + NOP will provide two different current measurements ( best and worst cases), due to the memory alignment of the jump$(diassembled while(1) ) instruction. The MSP430 architecture has a 32-bit fetch from flash, the following two images will showcase the difference between using while(1) or while(1) + NOP, and how the current consumption changes accordingly.

    Case While(1) :
    The jmp$ instruction is aligned at memory location 0x00807C, and consumes 58 uA. This is the best case scenario, the MCU fetches the $jmp instruction in the first 16-bit fetch, continues to execute the same instruction  and does not required to access flash after the first fetch.

    Case NOP+while(1):
    The jmp$ instruction is aligned at memory location 0x00807E, and consumes 67 uA. This is the worst case scenario, the MCU fetches the $jmp instruction in the second 16-bit fetch, requiring the MCU to perfom two 16-bit fetch from flash for a single jmp$ instruction.

    -Erick

**Attention** This is a public forum