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-MSPM0G3507: Setting up the interrupt code/sysconfig

Part Number: LP-MSPM0G3507
Other Parts Discussed in Thread: SYSCONFIG, MSPM0G3507

I have set 2 gpio's as input.(PA18,PB21) and set them to interrupt on falling edge. The GPIO_input_capture example provided shows how to use a single interrupt. I would like to do the same thing with 2 interrupts. Could an explanation also be given to what exactly is happening in the example provided and what else should I add to the below code for the 2nd interrupt(couldn't find any related interrupt docs in trm). What I am trying is to turn on the led by first interrupt and off by the second interrupt. And in the example it seems that the input pin(where the interrupt occurs) is internally pulled up. I can't understand where in the code or sysconfig a internal pull up is given?

BELOW IS THE EXAMPLE PROVIDED:
#include "ti_msp_dl_config.h"
extern volatile uint32_t interruptVectors[];
int main(void)
{
    SYSCFG_DL_init();
    /*
     * Turn OFF LED if SW is open, ON if SW is closed.
     * LED starts OFF by default.
     */
    NVIC_EnableIRQ(GPIO_SWITCHES_INT_IRQN);
    while (1) {
        __WFI();
    }
}
void GROUP1_IRQHandler(void)
{    switch (DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP_1))
    {      case GPIO_SWITCHES_INT_IIDX:
            if (DL_GPIO_readPins(GPIO_SWITCHES_PORT, GPIO_SWITCHES_USER_SWITCH_1_PIN)) /* If SW is high, turn the LED off */
            {
                DL_GPIO_setPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
            }
            else  /* Otherwise, turn the LED on */
            {
                DL_GPIO_clearPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
            }
            break;
    }
}
  • Ok got where internal resistor settings are.

    It seems no internal resistor is in use.

  • Hi Sureshan,

    If you look at the GPIO page in Sysconfig, then look at the GPIO_SWITCHES tab in the original un-edited example, then open the digital iomux features tab, you should see that the switch does have the internal pull up enabled. The internal resistors are disabled for the LED GPIO because that resistor is external and already present on the launchpad. Additionally, the internal resistors are too high of a value for usage with the LED.

    As for servicing two interrupts with one handler, I would recommend that you take a look at the gpio_simultaneous_interrupts example found in [SDK Install Path]\mspm0_sdk_1_30_00_03\examples\nortos\LP_MSPM0G3507\driverlib\gpio_simultaneous_interrupts. This example toggles LEDs based on the input for 3 switch GPIOs using one interrupt handler.