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.

MSP430FR6877: Port ISR comes once after flashing

Part Number: MSP430FR6877

I am using IAR for flashing/debugging, and I am configuring Port 4.2 as interrupt, and this pin is connected to a switch.

When I run the first time after flashing, the interrupt comes. When I do reset using the IAR then run again, it works properly, the interrupt doesn't come until the switch is pressed.

The configuration for this pin is as following:

/* configure the push button as input interrupt pin
  *  Enable P4.2 internal resistance as pull-Up resistance */ 
  GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P4,GPIO_PIN2);
  /* set the edge of interrupt as falling edge */
  GPIO_selectInterruptEdge(GPIO_PORT_P4,GPIO_PIN2,GPIO_HIGH_TO_LOW_TRANSITION);
  /* clear and enable the interrupt  */
  GPIO_clearInterrupt(GPIO_PORT_P4,GPIO_PIN2);
  GPIO_enableInterrupt(GPIO_PORT_P4,GPIO_PIN2);

And I do interrupt enable at the end of the initialization as following:

__bis_SR_register(GIE);

Do I need to clear port 4 interrupts at the initialization to clear any pending things?

What can cause this interrupt to be pending although the switch is not pressed?

  • Your sequence looks right -- clear, then enable. The first thing I would do is breakpoint just before the GIE setting and look at P4IE and P4IFG in the debugger.

    When do you call PMM_unlockLPM5()? The order matters. [Ref User Guide (SLAU367P) Sec 12.3.1]

**Attention** This is a public forum