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.

RTOS/TM4C1294NCPDT: create/enable interrupt on GPIO pin PP3

Part Number: TM4C1294NCPDT

Tool/software: TI-RTOS

Hi,

I am using an EK_TM4C1294XL  development board and I want to create an interrupt handler on pin PP3 (Port P, pin 3). For this, I adjusted the EK_TM4C1294XL.c and EK_TM4C1294XL.h files and added the pin using the following code for the .c file:

GPIO_PinConfig gpioPinConfigs[] = {
    /* Input pins */
    /* EK_TM4C1294XL_USR_SW1 */
    GPIOTiva_PJ_0 | GPIO_CFG_IN_PD | GPIO_CFG_IN_INT_RISING,
    /* EK_TM4C1294XL_USR_SW2 */
    GPIOTiva_PJ_1 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING,
    /* EK_TM4C1294XL_PP3 */
    GPIOTiva_PP_3 | GPIO_CFG_IN_PD | GPIO_CFG_IN_INT_RISING,

    /* Output pins */
    /* EK_TM4C1294XL_USR_D1 */
    GPIOTiva_PN_1 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    /* EK_TM4C1294XL_USR_D2 */
    GPIOTiva_PN_0 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
};

and for the .h file:

typedef enum EK_TM4C1294XL_GPIOName {
    EK_TM4C1294XL_USR_SW1 = 0,
    EK_TM4C1294XL_USR_SW2,
    EK_TM4C1294XL_PP3,
    EK_TM4C1294XL_D1,
    EK_TM4C1294XL_D2,

    EK_TM4C1294XL_GPIOCOUNT
} EK_TM4C1294XL_GPIOName;

I attach the interrupt in the main file using this code:

int main(void)
{
    /* Call board init functions */
    Board_initGeneral();
    Board_initGPIO();
    Board_initEMAC();

    System_printf("Starting the TCP Echo example\nSystem provider is set to "
                  "SysMin. Halt the target to view any SysMin contents in"
                  " ROV.\n");
    /* SysMin will only print to the console when you call flush or exit */
    System_flush();

    setUpPool();
    GPIO_write(Board_LED0, Board_LED_ON);
    GPIO_setCallback(EK_TM4C1294XL_PP3, gpioButtonFxn0);
    GPIO_enableInt(EK_TM4C1294XL_PP3);

    /* Start BIOS */
    BIOS_start();

    return (0);
}

However, when I connect pin PP3 to 3.3V for the rising edge, I get an error and it goes to exit. 

Can someone help me?

Thanks,

Jonas.

  • Hi Jonas,
    Where or how did you register PP3 interrupt source? Where is PP3 interrupt handler code? Is there debounce code added for the PP3 input?

    Better yet why not try polling the onboard user buttons from Tivaware examples, then switch example code to use PP3 interrupt handler?
  • Hi BP101,

    The handler code is the gpioButtonFxn0 function in the GPIO_setCallback function. When I replace the EK_TM4C1294XL_PP3 with EK_TM4C1294XL_USR_SW1, the code works. But I want to be able to use different pins for interrupts then only the two of the user buttons.

    Jonas