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: GPIO callback not called

Tool/software: TI-RTOS

I am using ti-processor-sdk-rtos-am57xx-evm-03.01.00.06 with SYS/BIOS 6.45.01.29 GA Release for evm AM572x device and CCS v6.2.

Running TI RTOS on Cortex M4.

I have configured the pin as Input and I am registering the GPIO callback but I am not getting the gpio callback called when given trigger externally.
When same pin is configured as output and do gpio toggle is working fine.

Is there any step i have missed to get the interrupt callback?

GPIO6_19
#define GPIO_PIN_NUM    (0x13) // 19
#define GPIO_PORT_NUM   (0x06)    
GPIO_PinConfig gpioPinConfigs[] = {

    GPIO_DEVICE_CONFIG(GPIO_PORT_NUM, GPIO_PIN_NUM) |
    GPIO_CFG_INPUT |GPIO_CFG_IN_INT_BOTH_EDGES
}


Void taskFxn(UArg a0, UArg a1)
{
    System_printf("enter taskFxn()\n");
    
    /* GPIO initialization */
    GPIO_init();

    /* Set the callback function */
    GPIO_setCallback(0U, AppGpioCallbackFxn);

    /* Enable GPIO interrupt on the specific gpio pin */
    GPIO_enableInt(0U);

}

/*
 *  ======== Callback function ========
 */
void AppGpioCallbackFxn(void)
{
    count++;
    System_printf("AppGpioCallbackFxn %d\n",count );
    //gpio_intr_triggered = 1;
}

  • The RTOS team have been notified. They will respond here.
  • Hi,

    What AM57x EVM are you using? There are ARM/DSP/M4 LED blinking examples already in GPIO driver folder, it uses GPIO callback. Did you try any of those examples? Do you have BOARD_INIT() called? And if configure to GPIO_CFG_IN_INT_RISING work for you? How do you trigger interrupt? Is something like: GPIOTriggerPinInt(gpioBaseAddr, 0, gpioPin)?

    Regards, Eric
  • Dear Eric,

     I am using evm AM572x evaluation board. 

    Yes i have gone through LED blink example for Cortex M4.  In the example LED blink is happening, but the callback used is not getting called.

    Yes i have Board_init() called.

    I have tried GPIO_CFG_IN_INT_RISING also but still callback is not getting called

    To trigger interrupt. I tried following.

        Configured GPIO6_11 as OUTPUT and toggel this GPIO and short this with GPIO6_19 which i have configured as INPUT.

        Trigger interrupt from external source.

       I also used GPIOTriggerPinInt(CSL_IPU_GPIO6_REGS, 0, 0x13);

    In any of these case, callback not called.  Please let me know any thing else i can do ?

  • Hi,

    The LED blink example is based on GPIO interrupt callback. If you said it is blinking but no callback, I don't understand.

    For example, I tried run the same and set break point at AppGpioCallbackFxn(), this is the function everytime called back then toggle LED. The interrupt is genearted on LED0 and callback on LED0, GPIO toggle is on LED1. Those LEDs are defined in GPIO_evmAM572x_board:

    #define GPIO_USER0_LED_PIN_NUM (0x08)
    #define GPIO_USER0_LED_PORT_NUM (0x07)
    #if defined (__TI_ARM_V7M4__)
    #define GPIO_USER1_LED_PIN_NUM (0x10) /* IRQ mapped GPIO 1&2 banks for M4*/
    #define GPIO_USER1_LED_PORT_NUM (0x01) /* IRQ mapped GPIO 1&2 banks for M4*/
    #else
    #define GPIO_USER1_LED_PIN_NUM (0x09)
    #define GPIO_USER1_LED_PORT_NUM (0x07)
    #endif

    /* GPIO Driver board specific pin configuration structure */
    GPIO_PinConfig gpioPinConfigs[] = {
    /* Input pin with interrupt enabled : AM57X_IDK_GRN_LED */
    #if defined (__TI_ARM_V7M4__)
    GPIO_DEVICE_CONFIG(GPIO_USER1_LED_PORT_NUM, GPIO_USER1_LED_PIN_NUM) |
    GPIO_CFG_IN_INT_RISING | GPIO_CFG_INPUT,
    #else
    GPIO_DEVICE_CONFIG(GPIO_USER0_LED_PORT_NUM, GPIO_USER0_LED_PIN_NUM) |
    GPIO_CFG_IN_INT_RISING | GPIO_CFG_INPUT,
    #endif

    /* Output pin : AM57X_IDK_YEL_LED */
    GPIO_DEVICE_CONFIG(GPIO_USER0_LED_PORT_NUM, GPIO_USER0_LED_PIN_NUM) |
    GPIO_CFG_OUTPUT
    };

    The interrupt is triggered by GPIOTriggerPinInt(gpioBaseAddr, 0, gpioPin);

    Since you are using GP EVM, why you use different GPIO6_11/_19? If you want to use the GPIO toggle something else (not LED), then you need to follow the way how we toggle LED.

    Also, in PINMUX setting:

    /* GPIO6 - gpio6_11 on AB4 - GPIO6 */
    {0x1778, 0x60000, {0x0, 0, 0}, {0x0, 0, 0}, {0x0, 0, 0}},

    /* GPIO6 - gpio6_18 on E17 - GPIO6 */
    {0x1698, 0x4000E, {0x0, 0, 0}, {0x0, 0, 0}, {0x0, 0, 0}},

    /* GPIO6 - gpio6_19 on B26 - GPIO6 */
    {0x169C, 0x4000E, {0x0, 0, 0}, {0x0, 0, 0}, {0x0, 0, 0}},

    /* GPIO7 - gpio7_7 on A25 - GPIO7 (LEDs, PM signals) */
    {0x17A4, 0x4000E, {0x0, 0, 0}, {0x0, 0, 0}, {0x0, 0, 0}},

    /* GPIO7 - gpio7_8 on F16 - GPIO7 (LEDs, PM signals) */
    {0x17A8, 0x4000E, {0x0, 0, 0}, {0x0, 0, 0}, {0x0, 0, 0}},

    GPIO6_11 is set differently from 6_19/7_7/7_8, you may need to change 0x60000 to 0x4000E and rebuild the board library and re-try.

    Regards, Eric
  • LED blink is working I mean is, if I do GPIO_Toggle() in the place of GPIOTriggerPinInt(); LED blink is happening.

    But If I dont change any thing in example  and keep GPIOTriggerPinInt(); as it is AppGpioCallbackFxn() is not getting called.

     I also have one more question:

    In the example i see both index of pin config array  are configured for same pin GPIO_USER0. Index 0 as input and index 1 as Output.

    How this will work?

    /* GPIO Driver board specific pin configuration structure */
    GPIO_PinConfig gpioPinConfigs[] = {
        /* Input pin with interrupt enabled :*/
        GPIO_DEVICE_CONFIG(GPIO_USER0_LED_PORT_NUM, GPIO_USER0_LED_PIN_NUM) |
        GPIO_CFG_IN_INT_RISING | GPIO_CFG_INPUT,

        /* Output pin :
        GPIO_DEVICE_CONFIG(GPIO_USER0_LED_PORT_NUM, GPIO_USER0_LED_PIN_NUM) |
        GPIO_CFG_OUTPUT
    };

  • Hi Vinay,

    I am also stuck at the same point. Wasn't able to understand the lines. 

    GPIO_PinConfig gpioPinConfigs[] = {
    /* Input pin with interrupt enabled : AM57X_IDK_GRN_LED */
    GPIO_DEVICE_CONFIG((GPIO_USERD2_LED_PORT_NUM + 1), GPIO_USERD2_LED_PIN_NUM) |
    GPIO_CFG_IN_INT_RISING | GPIO_CFG_INPUT,

    /* Output pin : AM57X_IDK_YEL_LED */
    GPIO_DEVICE_CONFIG((GPIO_USER0_LED_PORT_NUM + 1), GPIO_USER0_LED_PIN_NUM) |
    GPIO_CFG_OUTPUT

    };

    My question is why are we configuring "GPIO_USER0_LED_PORT_NUM " as input and output at the same time......?