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.

MSP432 cannot wake up from LPM3 in non-debug mode

Hi,

        I modified the "driverlib\examples\MSP432P4xx\pcm\pcm_go_to_lpm3" code. As in my own board, P5.3 is the push button and P5.5 is the LED. The code is modified as follows:

/* DriverLib Includes */
#include "driverlib.h"

/* Standard Includes */
#include <stdint.h>

#include <stdbool.h>

int main(void)
{
    /* Halting the Watchdog */
    MAP_WDT_A_holdTimer();

    /* Configuring P1.0 as output and P6.7 (switch) as input */
    MAP_GPIO_setAsOutputPin(GPIO_PORT_P5, GPIO_PIN5);

    /* Configuring P6.7 as an input and enabling interrupts */
    MAP_GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P5, GPIO_PIN3);
    MAP_GPIO_clearInterruptFlag(GPIO_PORT_P5, GPIO_PIN3);
    MAP_GPIO_enableInterrupt(GPIO_PORT_P5, GPIO_PIN3);
    MAP_Interrupt_enableInterrupt(55);
    MAP_Interrupt_enableSleepOnIsrExit();
    
    /* Enabling MASTER interrupts */
    MAP_Interrupt_enableMaster();   

    /* Going to LPM3 */
    while (1)
    {
        MAP_PCM_gotoLPM3();
        __no_operation();
    }
}

/* GPIO ISR */
void gpio_isr(void)
{
    uint32_t status;

    status = MAP_GPIO_getEnabledInterruptStatus(GPIO_PORT_P5);
    MAP_GPIO_clearInterruptFlag(GPIO_PORT_P5, status);

    /* Toggling the output on the LED */
    if(status & GPIO_PIN3)
    {
        MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P5, GPIO_PIN5);
    }

}

In debug mode, it works well. But In non-debug mode, in other words, without the debugger connected, it doesn't work.

Additionally, the "driverlib\examples\MSP432P4xx\pcm\pcm_go_to_lpm3" code works well in the MSP-EXP432P401R LaunchPad whether in debug mode or not. Is there any clue?

  • Hi user4484512,

     The reason that it works with the debugger connected is because you are not entering to LPM3. You will have to enable "allow power transitions" in the debug properties, please take a look at this thread.

    In regards to you example code, you will need to enable retention for SRAM bank 7 to prevent loss of stack during LPM3 mode, so the updated code (changed it to use P1.0 and P1.1 so it can be used with the MSP432 LP) looks like this:

    void main(void)
    {
    	MAP_WDT_A_holdTimer();
    	MAP_Interrupt_disableMaster();                // Disabling master interrupts
    
        /* Configuring P1.0 as output */
        MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0);
    
        MAP_GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P1, GPIO_PIN1);
        MAP_GPIO_interruptEdgeSelect(GPIO_PORT_P1, GPIO_PIN1, GPIO_LOW_TO_HIGH_TRANSITION);
        MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, GPIO_PIN1);
        MAP_GPIO_enableInterrupt(GPIO_PORT_P1, GPIO_PIN1);
    
        MAP_Interrupt_enableInterrupt(INT_PORT1);
        MAP_Interrupt_enableSleepOnIsrExit();
        MAP_Interrupt_enableMaster();
    
        /* Enable retention for SRAM bank 7 to prevent loss of stack during DSL mode */
        SysCtl_enableSRAMBankRetention(SYSCTL_SRAM_BANKEN_BNK7_EN);
    //    MAP_PCM_enableRudeMode();
    
        while (1)
        {
        	MAP_PCM_gotoLPM3();
        }
    }
    
    void gpio_isr(void)
    {
        uint32_t i, status;
    
        status = MAP_GPIO_getEnabledInterruptStatus(GPIO_PORT_P1);
    
        /* Toggling the output on the LED */
        if(status & GPIO_PIN1)
        {
            MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0);
    
        }
    
        /* Delay for switch debounce */
        for(i = 0; i < 10000; i++)
        MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, status);
    }
    

    Hopefully this helps.

      David

  • Hi, David,

           I've already tried your method to add SysCtl_enableSRAMBankRetention(SYSCTL_SRAM_BANKEN_BNK7_EN);, but there is also a problem. The code cannot go into LPM3, while it stops in the function SysCtl_enableSRAMBankRetention(SYSCTL_SRAM_BANKEN_BNK7_EN);. The disassembly code is as follows:

    In contrast to the C code of the function, I guess it stops at "while (!(SYSCTL->SRAM_BANKRET & SYSCTL_SRAM_BANKRET_SRAM_RDY));". The SRAM_RDY bit is always 0, and the code is trapped here. 

            As the Code cannnot go into LPM3, the current consumption is not right. What should I  do next?

  • Hi user4484512,

    Sorry for the delay, please take a look at this post e2e.ti.com/.../1759313

    Best regards,

    David
  • Thank you for your reply.

**Attention** This is a public forum