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.

LP-MSP430FR2476: LP-MSP430FR2476, operation when connected via USB

Part Number: LP-MSP430FR2476

#include "driverlib.h"

void main (void)
    //Stop watchdog timer

    //Set LED1 to output direction

    //Enable S1 internal resistance as pull-Up resistance

    //S1 interrupt enabled

    //S1 Hi/Lo edge

    //S1 IFG cleared


    //Enter LPM3 w/interrupt
    __bis_SR_register(LPM3_bits + GIE);

    //For debugger

//This is the PORT2_VECTOR interrupt vector service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=PORT2_VECTOR
#elif defined(__GNUC__)
void P2_ISR (void)
    //LED1 = toggle

    //S1 IFG cleared

When debugging the above program on the evaluation board,
Click “Resume”
The LED (green) lights up because it is set as GPIO_setOutputHighOnPin(GPIO_PORT_P5,GPIO_PIN0);.
After that, when I input P2.3, it toggles, but
After debugging, when I unplug the USB and reconnect it, the LED (green) does not light up. If you input P2.3, the torge will be activated.
When you connect the USB and supply power,
I think that GPIO_setOutputHighOnPin(GPIO_PORT_P5,GPIO_PIN0); is set and the LED lights up.
Why doesn't it light up?
By the way, setting GPIO_setOutputLowOnPin(GPIO_PORT_P5,GPIO_PIN0); will do the opposite. (LED lights up when connected via USB)

  • To summarize briefly:
    If you set GPIO_setOutputHighOnPin(GPIO_PORT_P5,GPIO_PIN0);, the LED will not light up when connected to USB.
    When you input P2.3, the LED turns ON/OFF, so the program is working.
    If you set GPIO_setOutputLowOnPin(GPIO_PORT_P5,GPIO_PIN0);, the LED will light up when connected to USB.
    When you input P2.3, the LED turns ON/OFF, so the program is working.

    After Debug, when you "Resume",
    When set as GPIO_setOutputHighOnPin(GPIO_PORT_P5,GPIO_PIN0);, the LED lights up. When set as GPIO_setOutputLowOnPin(GPIO_PORT_P5,GPIO_PIN0);, the LED does not light up.

    After debugging, I think that the behavior is correct when I select "Resume" and the behavior is incorrect when connected to USB.Why does this happen?

  • User Guide (SLAU445I) Sec 8.3.1 prescribes an ordering for initialization of the registers. In particular, it says to clear IFG and set IE after clearing LOCKLPM5.

    When I forget this, I sometimes see inconsistent behavior, but since that's operating outside the Specification, it isn't described anywhere. Part of it may be the difference between a POR and a debugger reset (which seems to resemble more a PUC).

  • PMM_unlockLPM5();



    Should I write the code in the order above?

  • Yes, that looks right.

**Attention** This is a public forum