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.
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
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
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.
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++) { now_sta = GPIO_read(0); UART_printf("level:%d cnt:%d sirq:%d dirq:%d\n", now_sta, cnt, sirq, dirq); } }
ok, let me check it on SDK8.4 on Monday and let you know the exact irq number to be used.
Regards,
Brijesh
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
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