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.

TDA4x,How to configure gpio interrupt

Hello,

I run a case on mcu1_0, now I want to add a gpio interrupt for test,do you have an example for gpio interrupt configure?

Thanks.

Qin

  • Hi Qin,

    Please refer to example pdk\packages\ti\drv\gpio\test\led_blink\src\main_led_blink.c in PDK for GPIO example. This GPIO blinks some LEDs  on EVM.

    Rgds,

    Brijesh

  • Dear Brijesh,

    I run the GPIO example on J721E EVM,and it looks normal through the log,but I didn't see some LEDs blink on the board. 

    then I add a log in the callback function,as a result,it didn't go to the callback function.what? the interrupt isn't be triggered? How should I do to verify it?

    Thanks,

    Qin

  • Hi Qin,

    Are you looking for interrupt? Does polling mode work fine?

    Rgds,

    Brijesh

  • Hi Brijesh,

    The while statement polling work fine,but it should not be triggered the interrupt. Do you have some documents about how to configure interrupt router?

    Thanks,

    Qin

  • Hi Qin,

    I think we need to configure Interrupt router and Aggregator to get interrupt.

    Let me check and tell you exact steps required.

    Rgds,

    Brijesh

  • Hi,

    This thread is being discussed over email, so closing it here.

    Rgds,

    Brijesh

  • Hi Brijesh,

    I have the same problem here: Maybe you could share here the information/ exact steps which are required?

    Thank you very much!

    Best regards,

    Thomas

  • Hi Thomas,

    Which GPIO are you trying to enable? Are you using GPIO driver to enable it?

    Rgds,

    Brijesh

  • I try to enable GPIO0_124, since its connected to J5:20 on the GESI expansion board.

    I configured it as output which works. I did this with GPIO driver.

    Now I want to configure it as interrupt source, but this does not work. I am confused how the GPIO driver works, and which information I need to get it working. I just want to trigger a function of RTOS when a interrupt was detected on that GPIO0_124.

  • Brijesh,

    I tracked my error down but need nevertheless some assistance, as you can see here:

    However, If I use this GPIO API, I can see that the bit for GPIO0_124 interrupt is set in register GPIO_INTSTAT67, but my registered ISR is not called:

    void someCallbackFunction(void)
    {
        volatile int foobar = 0;
        foobar++;
        System_printf("INTERRUPT OCCURED!!!!!!!!!\n");
        return;
    }
    
    /* GPIO Driver board specific pin configuration structure */
    GPIO_PinConfig gpioPinConfigs[] =
    {
        /* Input pin with interrupt enabled */
         GPIO_DEVICE_CONFIG(0, 124) | GPIO_CFG_OUTPUT,
    };
    
    /* GPIO Driver call back functions */
    GPIO_CallbackFxn gpioCallbackFunctions[] =
    {
        NULL,
    };
    
    /* GPIO Driver configuration structure */
    GPIO_v0_Config GPIO_v0_config =
    {
        gpioPinConfigs,
        gpioCallbackFunctions,
        sizeof(gpioPinConfigs) / sizeof(GPIO_PinConfig),
        sizeof(gpioCallbackFunctions) / sizeof(GPIO_CallbackFxn),
    #ifdef __TI_ARM_V7R4__
        0x8U
    #else
    #if defined(__C7100__)
        0x01U
    #else
        0x20U
    #endif
    #endif
    };
    
    int initCustomGpio()
    {
        GPIO_v0_HwAttrs gpio_cfg;
    
        GPIO_socGetInitCfg(0, &gpio_cfg); // 0 = GPIO_LED0_PORT_NUM
        GPIO_socSetInitCfg(0 /*GPIO PORT NUM*/, &gpio_cfg);
    
        //After configuration, init GPIO modules
        GPIO_init();
    
        //Set callback function and then enable interrupt
        GPIO_setCallback(0, (GPIO_CallbackFxn)&someCallbackFunction);
        GPIO_enableInt(0);
    
        GPIO_write(0, 0);
        GPIO_write(0, 1);
        GPIO_write(0, 0);
    }

    Maybe you could give me feedback, if I use the GPIO API here in a correct way.
    I think a lean and clean documentation from TI, how to use GPIO driver properly would helped me and other people a lot, which are new to TI SoCs.
    The overloaded/overcrowded GPIO blink led example does not help at all (at least for me). It's more confusing and frustrating digging to all the symbol defines to get a connection between the required GPIO register name values and TRM documentation.

  • Hi Thomas,

    I think you are providing the interrupt number. Please refer to GPIO_configIntRouter API in pdk\packages\ti\drv\gpio\test\led_blink\src\main_led_blink.c to understand ow to provide interrupt number to GPIO driver.

    Rgds,

    Brijesh

  • Hi Brijesh,

    I looked at main_led_blink.c example, but don't know how to configure the interrupt controller and interrupt router for executing a HWI on mcu2_0 with RTOS from interrupt by GPIO0_124.

    I ran the examples "GPIO_LedBlink_j721e_evm_mcu1_0TestApp_debug.xer5f" and "GPIO_Baremetal_LedBlink_j721e_evm_mcu1_0TestApp_debug.xer5f" on my TDA4VMXEVM, which both don't work. No LED is blinking on my board (Anyway, which LEDs should blink?).

    My current state is, that the GPIO0 module is configured in a correct way. I can see at the specific GPIO0 registers that the interrupt got successfully detected.
    Now I have to route this interrupt signal to mcu2_0 VIM (I think at least).

    This is what I puzzled from the TRM:

    1. GPIO_0_INT124 is connected to interrupt router "GPIOMUX_INTRTR0"

    2. GPIO_0_INT124 corresponds to GPIO0 Bank 7. (9.4.3.16) GPIOMUX_INTRTR0 Interrupt Map shows that GPIO0_GPIO_BANK7 is mapped to GPIOMUX_INTRTR0_IN_263.
    (Table 9-200. GPIOMUX_INTRTR0 Interrupt Map)

    3. If I look how GPIOMUX_INTRTR0 is integrated into MAIN_DOMAIN, I have no figure in the TRM (Section 9.3.2.2).

    What I need to do to route the interrupt from GPIOMUX_INTRT0 to mcu2_0??

  • Hi Thomas,

    We dont really need to explicitly configure interrupt router and controller. We need to use DMSC firmware for this.

    Rgds,

    Brijesh