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.

MSP430F5259: waking up lpm4

Part Number: MSP430F5259

My code of lpm4.5:

........

 PMMCTL0_H = PMMPW_H;                // Open PMM Registers for write
 PMMCTL0_L &= ~(SVSHE);              // Disable high-side SVS
 PMMCTL0_L |= PMMREGOFF;             // and set PMMREGOFF
 PMMCTL0_H = 0;                      // Lock PMM Registers

__bis_SR_register(LPM4_bits | GIE);

and the port ISR code:

#pragma vector=PORT1_VECTOR
__interrupt void Port_1_ISR(void)
{
    _bic_SR_register_on_exit(LPM4_bits);                   
                                                              
    P1IFG &= ~(SATIR_1 | SATIR_2 | SATIR_3 | SATIR_4 | SATIR_5); 
}

 Is LPM4 command valid for this mcu? Because it doesn't wake up and execute the codes from below lines...

if (SYSRSTIV == SYSRSTIV_LPM5WU)
 {

}

When I write the code for LPM3, microcontroller wake up and no problem.

thanks...

  • Hello,

    There is a great example code published for the MSP430F5259 that shows how to set up a port interrupt to wake up the MCU from LPM4. The example is called "msp430f525x_p1_02.c" and can be found in the TI Resource Explorer ( http://dev.ti.com/tirex/#/?link=Software%2FMSP430Ware%2FDevices%2FMSP430F5XX_6XX%2FMSP430F5259%2FPeripheral%20Examples%2FRegister%20Level ).

    This should give you a starting point for writing code to properly wake up from LPM4 using a port interrupt.

    Best regards,

    Matt Calvo

  • Hi Matthew,
    I think you don't read the message intent.
    I didn't find any code between your "great" examples about LPM4.5.
    Mcu doesn't wake up from this line.
    if (SYSRSTIV == SYSRSTIV_LPM5WU)
    {

    }
    With the same code for LPM3 or LPM4, there is no problem.
    I think LPM4.5 codes is deficient or incomplete.
  • Could it be related to that?
    From errata:
    PORT19 PORT Module
    Function Port interrupt may be missed on entry to LPMx.5
    Description If a port interrupt occurs within a small timing window (~1MCLK cycle) of the device entry
    into LPM3.5 or LPM4.5, it is possible that the interrupt is lost. Hence this interrupt will not
    trigger a wakeup from LPMx.5.
    Workaround None
  • Judging by the title of the post and the question posed in the text, I thought you were asking about implementing LPM4.

    Now that I know you are having trouble working with LPM4.5, there are a couple of references that may help point you in the right direction of at least understanding what's happening during LPM4.5 and why you may be seeing issues during debug. Section 1.4.2 of the device's User's Guide goes into great detail about how to enter and exit from LPM4.5 and gives some general guidelines and tips in the process. Another resource to take a look at is the "Debugging MSP430 LPM4.5" App Report which explores how to handle the device completely shutting off when you are trying to debug whether it correctly enters and exits LPM4.5.

    If you are using a Port interrupt to trigger a wake-up from LPM4.5 then I don't see how the PORT19 errata would affect you because there is a slim to none chance that a user is capable of pressing a button or toggling a pin faster than 1 MCLK cycle.

    Best regards,

    Matt Calvo

  • When you enter the LPM4.5 must use this code:
    UCSCTL6 |= XT1OFF | XT2OFF;

    with the below lines....

    PMMCTL0_H = PMMPW_H; // Open PMM Registers for write
    SVSMHCTL &= ~(SVMHE+SVSHE); // Disable High side SVS
    SVSMLCTL &= ~(SVMLE+SVSLE); // Disable Low side SVS
    PMMCTL0_L |= PMMREGOFF; // and set PMMREGOFF
    PMMCTL0_H = 0; // Lock PMM Registers
    __bis_SR_register(LPM4_bits | GIE);

    and the after exiting

    if (SYSRSTIV == SYSRSTIV_LPM5WU)
    {
    // After port setup must use below lines...

    PMMCTL0_H = PMMPW_H; // open PMM
    PM5CTL0 &= ~LOCKIO; // Clear LOCKBAK and enable ports
    PMMCTL0_H = 0x00; // close PMM// Hepsi CIKIS oldu.
  • if (SYSRSTIV == SYSRSTIV_LPM5WU)
    {
    // after port setup, must use below lines...

    PMMCTL0_H = PMMPW_H; // open PMM
    PM5CTL0 &= ~LOCKIO; // Clear LOCKBAK and enable ports
    PMMCTL0_H = 0x00; // close PMM

**Attention** This is a public forum