Jump to content

MSP430FR5969 refuses to go to sleep. Code works on G2553

Recommended Posts

I just got myself a FR5969, so far I'm really enjoying it.

I got the RTC going, very entertaining.

I got RTC interrupts going, also very entertaining.

Now I'm working on sleep mode, I want to use the RTC interrupts to wake up from sleep mode every once in a while, then sleep in LPM3 (or one of the LPMx.5 modes, eventually).


I spent longer than I'm willing to admit reading the FR5969 datasheet and setting registers, eventually ending up in assembly. It will not sleep.

Here is the basic test code I'm using right now:



int counter;
void setup()
  // put your setup code here, to run once:

void loop()
if (counter > 20000){

void wakeUp(){


On a G2553 (with the "PUSH1"'s changed to "P1_3", of course) this results in the LEDs starting turned off, and staying that way indefinitely.

If you push the button, the red LED comes on briefly, then goes off and the green LED comes on and stays on.

Further button presses result in more red LED flashes, eventually turning it on solidly when the counter gets high enough.


On the FR5969 the green LED comes on immediately on powerup, and the red LED comes on somewhere around 500-700ms later.

If I comment out LPM4; the red LED comes on much sooner, maybe 200-300ms.

Calling LPM4 is doing something, but what it is doing I have no idea.

I would dearly like to get this to work, very low power sleep being half the reason I bought this thing! (Low power awake being most of the other half)


The one thing I can think of that I have no done is try this in CCS. I rather like Energia and CCS has confused me so far, I'd rather use Energia if possible.



Has anybody else gotten LPM modes to work on this thing?

Link to post
Share on other sites

Digging through the Energia source code:

#define LPM4_bits           (SCG1+SCG0+OSCOFF+CPUOFF)
#define LPM4      _BIS_SR(LPM4_bits)     /* Enter Low Power Mode 4 */

Is this what you want to happen, or do you also want interrupts?


If you look at this thread from two years ago (or look at msp430fr59xx_p1_03.c in MSP430ware), it looks like you also want to enable interrupts:
_BIS_SR(LPM4_bits + GIE); // Enter LPM4 w/interrupt


Link to post
Share on other sites

That is exactly what I'm after, I've tried saying LPM4, also the _BIS_SR method, as well as _asm_ (" BIS etc.etc.).

This is with +GIE and without it, when I was doing it in assembly I was assembling the word in binary manually.


Having slept on it and read your post, your post did remind me that I hadn't tried specifically turning off interrupts.

Testing just now if I specifically turn off interrupts (via noInterrupts() or via _BIC_SR(GIE)) it goes to sleep and stays asleep!

It stays asleep forever as it's LPM4 and there aren't any interrupts, but this tells me a lot. Something is generating interrupts to wake this thing up. It's a bit odd that it can wake from LPM4 with a non-pin interrupt, unless Energia is doing the work to end up in LPM4.5 instead of LPM4 and the watchdog/millis is waking it up.

Next up is figuring out where the interrupts are coming from.


Thank you! I may or not have thought to test specifically disabling interrupts.

Link to post
Share on other sites

Ouf, I feel silly.

That was it.

Added "WDTCTL = WDTPW + WDTHOLD;" and voila, it sleeps interrupts enabled and wakes on pin interrupts.

It doesn't stay awake, but I know where to go for that. I was looking at that section of the datasheet yesterday.


Having gone back through the datasheet yet again I think I know what the problem was.

The FR5969 checks to see of moldules are requesting clock access/source and limits what LPMs are available based on that.

The WDT was requesting a clock and that was preventing deeper sleep than LPM1 (or maybe LPM0, depending on which clock).

That let it run after I told the MCU to LPM4, and as soon as the millis() interrupt attached to the WDT fires it wakes it up.

Now why disabling interrupts but allowing the WDT to run allowed sleep is beyond me, there're clearly things I don't understand here.

The basic problem is solved though. I appreciate the help!


As I dig deeper into all this I'll probably continue posting in this thread as there is limited information on this MCU in Energia available and I'd like to change that.

Link to post
Share on other sites

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...