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 "Interrupt Number" required for Hwi in TI RTOS nowhere to be found

I've been trying to find the "Interrupt Number" thats required when you setup TI RTOS to deal with hardware interrupts (Hwi). Multiple TI documents point to the datasheets for a list of interrupt numbers. But this does not exist in the MSP432 family datasheet, user guide nor on this forum. The only table relating to interrupts shows the mapping of the NVIC interrupt inputs on p81 of slas826a. 

I need to use the Hwi module, so where can I find this ominous Interrupt Number?

thanks

  • Hi bitmorsebits,

    I've moved this to the (Missing Group) where hopefully they will be able to give you a better answer. It might be the NVIC Interrupt Input number from the table you mentioned, but I am not sure if this is what TI-RTOS needs or not.

    Regards,
    Katie
  • Eric ran into this earlier this year. If I remember correctly, we found the correct Interrupt number by examining the device specific header file for the msp432p401r.h.

    He created a working TI-RTOS example for the MSP432. Look for it in the labs and solutions zip on the TI-RTOS Kernel Workshop wiki page.

    WIthin the lab_sols zip, you can find the MSP432 solution at the path shown here:

    TI_RTOS_labs_sols_rev4.00.zip

    • MSP430\Sols\blink_MSP432_401R_HWI_SOL.zip

    Take Care,
    Scott

  • You can get the interrupt number either from the header file as Scott mentions, or from the device datasheet.
    For example, from the header file, for Timer_TA0, the channel 0 compare interrupt is listed as “24” in msp432p401r.h:
    #define INT_TA0_0                                          (24)                  /* TA0_0 IRQ */ 

    Or in the device datasheet (www.ti.com/.../msp432p401r.pdf), you can find the Timer_A0 channel 0 interrupt in the “NVIC Interrupts” table (shown below as  “8”)
     

    And then add to this IRQ number an offset of “16” (to adjust for the lower 16 fault and system handlers), resulting in a value of “24”.
    Regards,
    Scott G
  • Thanks!
    Is there a method for checking which pin caused the interrupt?
  • No, there is no general peripheral API to determine which of multiple possible interrupt sources triggered a particular interrupt to be raised to the CPU.  Typically the peripheral driver will read the available interrupt flags within the peripheral to determine this.

    If you specifically want a “pin” ID for an I/O pin, you might want to look at how the GPIO driver for the MSP432 does this.  Open ti/drivers/gpio/GPIOMSP432.c and look at GPIO_hwiIntFxn().

    Regards,
    Scott G

  • Scott Gary said:
    ...you might want to look at how the GPIO driver

    As Scott Gary mentions, you may want to look at using the GPIO driver in TI-RTOS to setup and manage your GPIO.

    If you don't plan to use this driver, there are an MSPWare DriverLib functions that you can use to determine which GPIO pin(s) triggered an interrupt. For example, the port status function let's you read the I/O port of interest. The following code snipped was extracted from the "gpio_input_interrupt_.c" example that ships with DriverLib:

    uint32_t status;
    
        status = MAP_GPIO_getEnabledInterruptStatus(GPIO_PORT_P1);
        MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, status);

    Once you have the port value, you can determine which pin (or pins) caused the interrupt. 

    Another solution - in fact, my preferred solution - uses a unique feature on MSP devices. When multiple events can trigger a common interrupt, such as in the case where an 8-bit I/O port generates a single CPU interrupt,  you will find a "IV" register which provides the highest-priority, pending interrupt. Reading this register is a handy way to determine which interrupt event to service. It is common to read this register (e.g. Port 1 IV register) as part of a switch statement. Here is an example that handles the two buttons found on the MSP432 LaunchPad:

    //*****************************************************************************
    // Interrupt Service Routine
    //*****************************************************************************
    void Port1_ISR (void)
    {
        switch( P1IV ) {
            case P1IV__NONE:   break;                               // None
            case P1IV__P1IFG0:                                      // Pin 0
                 __no_operation();
                 break;
            case P1IV__P1IFG1:                                       // Pin 1 (button 1)
                 GPIO_toggleOutputOnPin( GPIO_PORT_P1, GPIO_PIN0 );
                 break;
            case P1IV__P1IFG2:                                       // Pin 2
                 __no_operation();
                 break;
            case P1IV__P1IFG3:                                       // Pin 3
                 __no_operation();
                 break;
            case P1IV__P1IFG4:                                       // Pin 4 (button 2)
                 GPIO_toggleOutputOnPin( GPIO_PORT_P2, GPIO_PIN1 );
                 break;
            case P1IV__P1IFG5:                                       // Pin 5
                 __no_operation();
                 break;
            case P1IV__P1IFG6:                                       // Pin 6
                 __no_operation();
                 break;
            case P1IV__P1IFG7:                                       // Pin 7
                 __no_operation();
                 break;
            default:   break;
        }
    }

    Hope this helps,
    (The Other) Scott