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.

TM4C1290NCPDT: Firmware jumps to wrong ISR function

Part Number: TM4C129ENCPDT

Hello, 

I have two Interrupts setup on PD2 and PD3 pins.  However the firmware will always jump to PD3 (PS_RESET_REQ_PIN) ISR.

Here is my initialization for the two pins.

//PD2 Pin = PS_ONOFF_REQ_PIN
void PS_ONOFF_Req_interrupt_enable(void)
{
    ROM_GPIOPinTypeGPIOInput(PS_PORT2, PS_ONOFF_REQ_PIN);
    IntMasterDisable();
    GPIOPinTypeGPIOInput(PS_PORT2, PS_ONOFF_REQ_PIN);
    GPIOPadConfigSet(PS_PORT2, PS_ONOFF_REQ_PIN, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);  // Enable weak pullup resistor for ADC_BUSY
    GPIOIntDisable(PS_PORT2, PS_ONOFF_REQ_PIN);        // Disable interrupt for ADC_BUSY (in case it was enabled)
    GPIOIntClear(PS_PORT2, PS_ONOFF_REQ_PIN);      // Clear pending interrupts for ADC_BUSY
    GPIOIntRegister(PS_PORT2, PSONOFFReqIntHandler);
    GPIOIntTypeSet(PS_PORT2, PS_ONOFF_REQ_PIN, GPIO_FALLING_EDGE);             // Configure for Rising and Falling Edge
    GPIOIntEnable(PS_PORT2, PS_ONOFF_REQ_PIN);     // Enable interrupt for ADC_BUSY
    IntMasterEnable();

}

//PD3 Pin = PS_RESET_REQ_PIN
void PS_LocalReset_Req_interrupt_enable(void)
{

    IntMasterDisable();
    ROM_GPIOPinTypeGPIOInput(PS_PORT2, PS_RESET_REQ_PIN);
    GPIOPinTypeGPIOInput(PS_PORT2, PS_RESET_REQ_PIN);
    GPIOPadConfigSet(PS_PORT2, PS_RESET_REQ_PIN, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);  // Enable weak pullup resistor for ADC_BUSY
    GPIOIntDisable(PS_PORT2, PS_RESET_REQ_PIN);        // Disable interrupt for ADC_BUSY (in case it was enabled)
    GPIOIntClear(PS_PORT2, PS_RESET_REQ_PIN);      // Clear pending interrupts for ADC_BUSY
    GPIOIntRegister(PS_PORT2, PSResetReqIntHandler);
    GPIOIntTypeSet(PS_PORT2, PS_RESET_REQ_PIN, GPIO_FALLING_EDGE);             // Configure for Rising and Falling Edge
    GPIOIntEnable(PS_PORT2, PS_RESET_REQ_PIN);     // Enable interrupt for ADC_BUSY
    IntMasterEnable();

}
 

and here is the ISR interrupt Handler for both interrupts;

//Interrupt handler for PD3 (PS_RESET_REQ_PIN)
void PSResetReqIntHandler(void)
{
    GPIOIntClear(PS_PORT2, PS_RESET_REQ_PIN);
    UARTprintf("\r\nLocal Reset button pressed");

}

//Interrupt handler for PD2 (PS_ONOFF_REQ_PIN)
void PSONOFFReqIntHandler(void)
{
    GPIOIntClear(PS_PORT2, PS_ONOFF_REQ_PIN);

    UARTprintf("\r\nLocal On button pressed");

}
 

Any idea ?

Thanks

  • Hello Sahil,

    Per-pin interrupts are only available on Ports P and Q. For Port D all pins are handled by a single interrupt, hence why you can't break up the ISR. You can check which pin triggered the interrupt and then execute your code according by using GPIOIntStatus.

    Best Regards,

    Ralph Jacobi

  • Hello Ralph,

    How can I check which pin triggered the interrupt ? you mean reading the interrupt status register ? Can you share the interrupt register name etc ?

  • Hello Sahil,

    Yes that is what GPIOIntStatus helps with. It will identify the exact pin(s) that have an interrupt triggered on them.

    Here is the API description from TivaWare:

    //! Gets interrupt status for the specified GPIO port.
    //!
    //! \param ui32Port is the base address of the GPIO port.
    //! \param bMasked specifies whether masked or raw interrupt status is
    //! returned.
    //!
    //! If \e bMasked is set as \b true, then the masked interrupt status is
    //! returned; otherwise, the raw interrupt status is returned.
    //!
    //! \return Returns the current interrupt status for the specified GPIO module.
    //! The value returned is the logical OR of the \b GPIO_INT_* values that are
    //! currently active.

    Best Regards,

    Ralph Jacobi

  • Thanks Ralph for your help.