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.

MSP430F5529: Entering and exiting LPM4 and LPM4.5

Part Number: MSP430F5529

Hello,

A question about entering and exiting LPM 4 and LPM4.5

In active mode, I have HFXT and LFXT on 

FLL source = HFXT 4MHz

MCLK and SMCLK source = DCO FLL set to 24MHz

ACLK source = LFXT 32.768KHz

Question

Before entering LPM4, do I need to write the code to turn off HFXT and LFXT and set

MCLK, SMCLK and ACLK  source = REFCLK or VLO, before going to _BIS_SR(LPM4_bits + GIE);? Or does the BIS_SR line take care of the clock switching automatically?

Also, do I have to do the same thing before entering LPM4.5

When exiting from LPM4, i'm going to use GPIO input using a pushbutton

PortISR()

{

Debounce()

__bic_SR_register_on_exit(LPM4_bits);

ConfigureClocksforActiveMode();

}

Are the steps above correct? Do I need to configure the clocks back to how I had set it up in active mode before I exit the ISR? 

In the case of LPM4.5, I understand that a reset occurs so I assume my clocks will be set to active in the initialization phase of my code -> is my understanding correct here or am I missing something?

Thanks.

AJ

  • Oh and I forgot to mention, in active mode, I am at VCORE3... so before entering LPM4 or LPM4.5, do I need to decrease VCORE to 0? And then after exit of LPM, set VCORE back again to 3?
  • You do not need to disable the XT1/XT2 clock sources; they are automatically shut down in LPM4 (unless you have cleared the XT1OFF/XT2OFF bits; see sections 5.2.4/5.2.5 of the User's Guide for details).

    MCLK, SMCLK, and ACLK will stay active if they are requested by a peripheral module (see section 5.2.11 of the User's Guide). If their clock source is no longer active, they will go to fail-safe mode and temporarily use the DCO or REFO as clock source (see section 5.2.12).

    XT1/XT2 are automatically restarted after going out of LPM4. However, the crystal needs some time until it starts oscillating correctly, and XT1/XT2 will not actually be used until the software has cleared the fault status bits (just as when initializing the crystals).

    For high clock frequencies, you need a high VCORE, but low clock frequencies (or a stopped clock) work with all VCORE settings.

    What happens after coming out of LPMx.5 depends on your reset code. If it always runs the same initialization code, the hardware will always be initialized.
  • Hi Clemens,

    Just additional question. What is the correct syntax to enter LPM4.5? I tried doing this bec I found it on another forum

    PMMCTL0_H = PMMPW_H; // open PMM
    PMMCTL0_L |= PMMREGOFF; // set Flag to enter LPM4.5 with LPM4 request
    __bis_SR_register(LPM4_bits|GIE);
    __no_operation();

    I have also enabled PORT1 and PORT 2 interrupts before the code above..
    Anway, so I went to execute those lines to enter LPM4.5 but I have been having trouble waking up. I would press the pushbuttons on Port 1 or Port 2. I could see the current go active but I'm in a state where my code just hang and I don't think it went through my initialization code correctly because LEDs should light up. Also at LPM4.5, I noticed my current is at 5uA. for LPM4.5, I did not have to configure any pins the right way right? I don't understand why I am not getting .035uA as shown on datasheet.

    Thanks
    AJ
  • Clemens,

    I figured out the high current... I forgot I had external circuitry. When I took them all out, I was getting 0.3uA. However, I am still not waking up properly. I would see a rise in current to about 7 to8mA but somewhere there I get hang. I can't send bytes to USB, I can't turn LED on.. basically my code is not working. But I think I did wake up the processor.... the only way I could get out of the hang state is recycling power. Any thoughts?
    Thanks.
    AJ
  • One more thing I forgot to mention.. pressing the reset button on the Launchpad did not solve the problem either. The only thing that got me out of that "hang" state was to cut the power off.

  • I do not know what is wrong with your code because I cannot see your code.

    You have to take care of everything mentioned in section 1.4.2 of the User's Guide.
  • No worries, I have already figured it out. I just need to enable the ports after the reset so I added that instruction in the initialization routine.

    Thanks.
    AJ

**Attention** This is a public forum