Good morning!
I have just started with my MSP432 launchpad. I may be assuming some things wrong from my past experiences, so somehow my first attempts with this MCU are being a little confusing. Let's see if you can help me with these, I assume so, simple questions :)
This is the code, extracted most of it from TI Resource Explorer:
/******************************************************************************* * MSP432 PCM - Going to LPM3 * * Description: In this very simple example, the use of the PCM API to go to * LPM3 is demonstrated. The device is configured for GPIO interrupt * (to wake the device up when the user presses the button on P1.1) and then * the device is put into LPM3 using the PCM_gotoLPM3 function. * * MSP432P401 * ------------------ * /|\| | * | | | * --|RST P1.0 |---> P1.0 LED * | | * | P1.1 |<--Toggle Switch * | | * | | * * Author: Timothy Logan *******************************************************************************/ /* 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 */ MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0); /* Configuring P1.1 as an input and enabling interrupts */ MAP_GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P1, GPIO_PIN1); MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, GPIO_PIN1); MAP_GPIO_enableInterrupt(GPIO_PORT_P1, GPIO_PIN1); MAP_Interrupt_enableInterrupt(INT_PORT1); MAP_Interrupt_enableSleepOnIsrExit(); /* Enabling MASTER interrupts */ MAP_Interrupt_enableMaster(); /* Going to LPM3 */ while (1) { MAP_PCM_gotoLPM3(); } } /* GPIO ISR */ void gpio_isr(void) { uint32_t status; volatile uint32_t i; status = MAP_GPIO_getEnabledInterruptStatus(GPIO_PORT_P1); MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, status); /* Toggling the output on the LED */ if(status & GPIO_PIN1) { MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0); for(i = 0; i < 10000; i++); } }
My first question is:
Since this is a power conservative example from TI, why aren't the unused pins and ports of MSP432 configured as low-level output?
My second question is:
This code works well when I debug in CCS. However, when I stop the debugging session and run the code just by powering the launchpad, after some button presses, pauses and / or long presses, the code seems to freeze and the LED does not toggle anymore.
Last question is:
If I'm going into LPM modes, should I activate the "allow power transitions while running if supported" option?
I'm continuously checking the CCS for MSP432 manual but please let me know of any MSP430-like assumptions I have to get rid of for MSP432, if any. I'm probably assuming something or omitting something.
Have a really nice day!