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

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)
{
    cnt++;
}

static void GPIO_configIntRouter(uint32_t portNum, uint32_t pinNum, uint32_t gpioIntRtrOutIntNum, GPIO_v0_HwAttrs *cfg)
{
    GPIO_IntCfg       *intCfg;
    uint32_t           bankNum = 0U;

    intCfg = cfg->intCfg;

    cfg->baseAddr = 0x600000UL;

    bankNum = pinNum/16; /* Each GPIO bank has 16 pins */    

    intCfg[pinNum].intNum = 176 + bankNum;  //CSLR_R5FSS1_CORE0_INTR_GPIOMUX_INTRTR0_OUTP_16
    intCfg[pinNum].intcMuxNum = INVALID_INTC_MUX_NUM;
    intCfg[pinNum].intcMuxInEvent = 0;
    intCfg[pinNum].intcMuxOutEvent = 0;
}

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

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;

   
    rmIrqReq.src_id = 105;  //TISCI_DEV_GPIOMUX_INTRTR0;
    rmIrqReq.src_index = 21; //Need to add 128 for GPIO1

    /* Set the destination based on the core */
    rmIrqReq.dst_id = 247;  //TISCI_DEV_R5FSS1_CORE0;
    rmIrqReq.dst_host_irq = 257;    //don't know how to set this

    /* 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;

    Sciclient_rmIrqSet(
                (const struct tisci_msg_rm_irq_set_req *)&rmIrqReq,
                &rmIrqResp,
                SCICLIENT_SERVICE_WAIT_FOREVER);
    
}

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;

    GPIO_configIntRouter(0, 21, 0, &gpio_cfg);
    
    *(volatile uint32_t *)0x00011C058 = 0x0050007;

    GPIO_socSetInitCfg(0, &gpio_cfg);
    
    SetRmIrqGPIO();

    GPIO_init();
    
    GPIO_setCallback(0, AppGpioCallbackFxn);
    GPIO_enableInt(0);

    while(1)
    {
        flag = GPIO_read(0);
        UART_printf("cnt: %d, %d\n", flag, cnt);
        appLogWaitMsecs(100u);
    }
}

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