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.

TDA4VM: GPIO interrupt setup

Part Number: TDA4VM


Good afternoon,

I'm working with the SDK RTOS v.08.06.00.12 and I implemented a code that configured an interrupt on the GPIO0_77 on the both edge.

The code runs on the mcu2_0 and starts using SBL.

My code works fine but I have a doubt about what I did to make it work.

In my main code mainly I did so (before I defined a GPIO_PinConfig and a GPIO_CallbackFxn and the GPIO0_77 is defined as and input with interrupt both edge at the index 0):

Board_initCfg boardCfg = BOARD_INIT_PINMUX_CONFIG;
Board_init(boardCfg);

GPIO_v0_HwAttrs gpio_cfg;
GPIO_socGetInitCfg(0, &gpio_cfg);

GPIO_configIntRouter(0, 77, 0, &gpio_cfg);                    (in this function I used this code:    intCfg[pinNum].intNum = CSLR_GPIOMUX_INTRTR0_IN_GPIO0_GPIO_BANK_4 + bankNum;)
GPIO_socSetInitCfg(0, &gpio_cfg);

GPIO_init();

GPIO_setCallback(0U, getBothEdge);
GPIO_enableInt(0U);

My questions are these:

  1. why do I call the GPIO_configIntRouter if the intNum variable is set in the GPIO_socConfigIntrPath called by the GPIO_setConfig_v0 called by the GPIO_init_v0?
  2. why do I have to change the set of the dst_host_irq variable in the GPIO_socConfigIntrPath function?

GPIO_socConfigIntrPath function original code:

dst_host_irq = irq_range_start + bankNum;

GPIO_socConfigIntrPath function in my code:

dst_host_irq = irq_range_start;

In addition I want to ask you:

  • is it possible to check which edge of the signal triggers the interrupt when the interrupt is configured as both edges?

Thank you.

Regards,

Matteo Radaelli

  • Hello,

    Due to a  regional holiday, half of our team is currently out of office. Please expect a 1~2 day delay in responses.

    Apologies for the delay, and thank you for you patience.

    Thanks.

  • Hi,

    Apologies for delay in response.

    why do I call the GPIO_configIntRouter if the intNum variable is set in the GPIO_socConfigIntrPath called by the GPIO_setConfig_v0 called by the GPIO_init_v0?

    I don't think that a call to GPIO_configIntRouter  is really required for J721E. The API seems relevant for AM65 and AM64x SOCs. For J721E all it does is set the base address for gpio_cfg and initialises other parameters of GPIO_Intcfg to 0 which can be done outside of this API as well. It does not even configure the interrupt number. 

    I believe you can safely skip this API as long as you are configuring the base address and initialising the remaining parameters properly.

    why do I have to change the set of the dst_host_irq variable in the GPIO_socConfigIntrPath function?

    Is your bank number > irq_range_num? 

    The device manager allocates a limited number of interrupts for a given core and the driver is only configuring the interrupts from bank[0] to bank[irq_range_num] but you can safely use the interrupts for any bank as long as you are configuring allocated number of interrupts for that core. This is something that we can improve in the driver code. I'll take this up with the development team.

    Regards,
    Parth