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: How to implement GPIO input interrupt function on mcu3_0

Part Number: TDA4VM

Hi team,

  I configure GPIO for this, but it can't work right.

gpio0_21  input

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
GPIO_PinConfig gpioPinConfigs[] = {
GPIO_DEVICE_CONFIG(0, 21) | GPIO_CFG_INPUT | GPIO_CFG_IN_INT_RISING
};
/* 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),
0,
};
uint32_t cnt = 0;
void AppGpioCallbackFxn(void)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

set RmIrq ,I'm not sure if it's right

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
static void SetRmIrqGPIO()
{
struct tisci_msg_rm_irq_set_req rmIrqReq;
struct tisci_msg_rm_irq_set_resp rmIrqResp;
memset(&rmIrqReq, 0x0, sizeof(rmIrqReq));
memset(&rmIrqResp, 0x0, sizeof(rmIrqResp));
rmIrqReq.valid_params = 0U;
rmIrqReq.global_event = 0U;
rmIrqReq.src_id = 0U;
rmIrqReq.src_index = 0U;
rmIrqReq.dst_id = 0U;
rmIrqReq.dst_host_irq = 0U;
rmIrqReq.ia_id = 0U;
rmIrqReq.vint = 0U;
rmIrqReq.vint_status_bit_index = 0U;
rmIrqReq.secondary_host = TISCI_MSG_VALUE_RM_UNUSED_SECONDARY_HOST;
rmIrqReq.secondary_host = TISCI_MSG_VALUE_RM_UNUSED_SECONDARY_HOST;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void AppGpioCallbackFxn(void)
{
cnt++;
}
static void appMain(void* arg0, void* arg1)
{
GPIO_v0_HwAttrs gpio_cfg;
uint8_t flag = 0;
Board_initCfg boardCfg;
boardCfg = BOARD_INIT_UART_STDIO ;//| BOARD_INIT_PINMUX_CONFIG| BOARD_INIT_MODULE_CLOCK;
Board_init(boardCfg);
appInit();
appRun();
Osal_delay(10000);
GPIO_socGetInitCfg(0, &gpio_cfg); //
gpio_cfg.baseAddr = 0x600000UL;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

after set this,I gave a 100Hz PWM pulse to GPIO0_21, I try to printf the value of cnt, but the value of cnt is always 0,

and GPIO_read(0) can get change of GPIO.

Can you tell me what is wrong with my configuration?

and I want to know how to set these  parameter?

rmIrqReq.src_id

rmIrqReq.src_index

rmIrqReq.dst_id

rmIrqReq.dst_host_irq

  • Hi,

    Can you please try interrupt, 176 to 179?

    Regards,

    Brijesh

  • Do you mean rmIrqReq.dst_host_irq or other?

  • I have try all the value, 176 to 179, but the cnt is still 0.

  • ok, can you please put a loop around Sciclient_rmIrqSet API for 1 to 511 dst_host_irq and see if it succeeds for any irq? 

    Regards,

    Brijesh

  • OK,I will try,is there anything else needs to modified?

  • No, just iterate over dst_host_irq. 

    we have allocated 4 output irq from GPIO to mcu3_0, so there should be atleast 4 irqs for which this code should pass.. 

    Regards,

    Brijesh

  • I have try src_id for 1 to 300, and dst_host_irq for 1 to 511, but nothing has changed.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    SetRmIrqGPIO:
    rmIrqReq.src_id = sirq; //TISCI_DEV_GPIOMUX_INTRTR0;
    rmIrqReq.src_index = 21; //Need to add 128 for GPIO1
    rmIrqReq.dst_id = 247; //TISCI_DEV_GPIOMUX_INTRTR0;
    rmIrqReq.dst_host_irq = dirq;
    main:
    while(1)
    {
    {
    dirq++;
    if (dirq == 512)
    {
    dirq = 1;
    sirq = (sirq == 339)?(1):(sirq+1);
    }
    SetRmIrqGPIO(sirq, dirq);
    for(i=0; i<10; i++)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • ok, let me check it on SDK8.4 on Monday and let you know the exact irq number to be used.

    Regards,

    Brijesh

  • OK,and I use SDK8.0, is it affect?

  • No, unless if you have changes in the board configuration..

  • Hi,

    Instead of using Sciclient_rmIrqSet API, can you please use Sciclient_rmIrqSetRaw API, as show below? 

    Here we are configuring GPIOMUx Interrupt router to connect input 21 (GPIO0_21) to output 16, which is connected to irq number 176 on mcu3_0. You could then use irq number 176 to register handler 

    struct tisci_msg_rm_irq_set_req rmIrqReq;
    struct tisci_msg_rm_irq_set_resp rmIrqResp;

    memset(&rmIrqReq, 0x0, sizeof(rmIrqReq));
    memset(&rmIrqResp, 0x0, sizeof(rmIrqResp));

    rmIrqReq.valid_params = 0U;
    rmIrqReq.global_event = 0U;
    rmIrqReq.src_id = 0U;
    rmIrqReq.src_index = 0U;
    rmIrqReq.dst_id = 0U;
    rmIrqReq.dst_host_irq = 0U;
    rmIrqReq.ia_id = 0U;
    rmIrqReq.vint = 0U;
    rmIrqReq.vint_status_bit_index = 0U;
    rmIrqReq.secondary_host = TISCI_MSG_VALUE_RM_UNUSED_SECONDARY_HOST;

    rmIrqReq.secondary_host = TISCI_MSG_VALUE_RM_UNUSED_SECONDARY_HOST;

    rmIrqReq.src_id = TISCI_DEV_GPIOMUX_INTRTR0;
    rmIrqReq.src_index = 21;

    /* Set the destination based on the core */
    rmIrqReq.dst_id = TISCI_DEV_GPIOMUX_INTRTR0;
    rmIrqReq.dst_host_irq = 16;

    /* Set the destination interrupt */
    rmIrqReq.valid_params |= TISCI_MSG_VALUE_RM_DST_ID_VALID;
    rmIrqReq.valid_params |= TISCI_MSG_VALUE_RM_DST_HOST_IRQ_VALID;

    status = Sciclient_rmIrqSetRaw(
    (const struct tisci_msg_rm_irq_set_req *)&rmIrqReq,
    &rmIrqResp,
    SCICLIENT_SERVICE_WAIT_FOREVER);

    if (status == CSL_PASS)
    {
    printf("Worked fine \n");
    }
    else
    {
    printf("Failed \n");
    }

    Regards,

    Brijesh

  • hi Brijesh,

    I have tried what you said,but nothing has improved,is anything need to modify?

  • ok, at least now, you are able to register interrupt. Can you please now if interrupt is getting generated in the INT_STAT register of the GPIO module?

    Regards,

    Brijesh

  • I modified this, now it's normal.

    and I want to know why src_id is same as dst_id,how to set them.

    Sciclient_rmIrqSet

    GPIO_setCallback

    Can't we use these two functions?

  • Well, we are just configuring GPIO MUX interrupt router, so source and destination are same. We are just connecting input 21 to output 16, which is connected to irq number 176 on muc3_0. 

    there is no need to use Sciclient_rmIrqSet now.

    Yes, you could use GPIO_setCallback API.

    Regards,

    Brijesh

  • OK,thank you very much!