Jump to content

Energia ide + msp430f5529lp + low power mode.

Recommended Posts

Hi all,

I want to use the "low power mode" function in my project but it doesn't work properly. My Platform of development is Energia IDE.

I would put the msp430f5529lp in "low power mode" and leave it with the push2 button.



#include <Energia.h>
#include <msp430f5529.h>


volatile int state = HIGH;
volatile int flag = HIGH;
int count = 0;

void setup()


  digitalWrite(GREEN_LED, state);

  /* Enable internal pullup.
   * Without the pin will float and the example will not work */
  attachInterrupt(PUSH2, interrupt, FALLING); // Interrupt is fired whenever button is pressed


void loop()
  digitalWrite(GREEN_LED, state); //LED starts ON

    flag = LOW;

void interrupt()
  state = !state;
  flag = HIGH; 




That's fine compile but don't work.  


Why ?

WHere is the problem ?


Thank you,

Link to post
Share on other sites

There is an easy way to do this using Energia functions that was posted by spirilis elsewhere.  Here is an example:

  Demonstrates a way to utilize LaunchPad low power modes with the
  sleep(), sleepSeconds(), suspend() and wakeup() functions in
  Energia. The LaunchPad will blink the red LED 3 times and
  demonstrate sleep() and sleepSeconds().  It then goes into suspend()
  but will wake up and start over again if the button is pushed.
  sleep() and sleepSeconds() use LPM3. suspend() uses LPM4.
void setup()
 pinMode(RED_LED, OUTPUT);                  // Make red LED an output
 pinMode(PUSH1, INPUT_PULLUP);              // Make push button input
 attachInterrupt(PUSH1, interrupt, FALLING);// Attach ISR to PUSH1

void loop()
  // Flash the LED - use sleep and sleepSeconds to save power by going
  // into LPM3
  for (int i = 0; i < 3; i++)           
    digitalWrite(RED_LED, HIGH);
    sleep(200);                        // use sleep for millis
    digitalWrite(RED_LED, LOW);
    sleepSeconds(1);                   // use sleepSeconds for seconds
  // Suspend and go into LPM4
void interrupt()
  wakeup();                            // wake up if button is pushed
Link to post
Share on other sites

Great...Thank you all,


I worked with version 12 and with the version 15, it's okay.


With my board, I have 2.5mA when it's in suspend().


Is what I could have even less ?

Probably.  Make sure all I/O ports are set to a stable value, not just left floating in input mode (which they are by default)... that goes for ALL I/O ports.  Also make sure you're not counting the power consumption of the FET up above.  Should get sub-10uA when you're golden.  Assuming nothing else in your circuit is also drawing power (no LEDs on, no power sinks/etc)

Link to post
Share on other sites

Thank you for you anwser Spirilis,


I have all my pin not use in configure   PXDIR = 0x00,  PXIN = 0x00 and PXOUT = 0xFF.


That is correct to have all pin in configure High Impedance ?


On my launchpad, I have take off all jumper for communicate between  msp430f5529 and emulator eZ-FET Lite.


Is what the power cut for eZ-FET Lite and USB HUB ?

Link to post
Share on other sites
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...