Other Parts Discussed in Thread: EK-TM4C1294XL
Hi,
I'm using TM4C129ENCPDT mcu to develop one of my projects on which I need to integrate TI RTOS. For that I need to configure hardware interrupt for 2 gpio pins. I configure as pre shown in the user guide but interrupt is not working. I made interrupt without using TI RTOS but not possible with Rtos.
1. How can configure the gpio for this as external hardware interrupt?
2. Can you share any sample code for this?
3. The functions in TI RTOS libraries are not provide arguments for both port and pin. Is any specific declaration present in it? or how can declare the port and pin?
GPIO_setConfig(GPIO_PIN_0, GPIO_CFG_INPUT | GPIO_CFG_IN_INT_BOTH_EDGES);
This is one of the function for configure the gpio pin. Is this correct way? Where we mention port?
The following is my code,
#define CT_SESR GPIO_PORTM_BASE | GPIO_PIN_0
bool motor_on;
Hwi_Handle hwiHandle;
/* GPIO interrupt handler */
void gpioInterruptHandler(uintptr_t arg)
{
uint32_t status = GPIOIntStatus(GPIO_PORTM_BASE, true);
if(status & (GPIO_PORTM_BASE | GPIO_PIN_0 | GPIO_PIN_7))
{
// find the interrupt status
motor_on = !(GPIOPinRead(GPIO_PORTM_BASE, GPIO_PIN_0)) | GPIOPinRead(GPIO_PORTM_BASE, GPIO_PIN_7);
// clear interrupt flag
GPIO_clearInt(CT_SESR);
}
}
int main(void)
{
/* Initialize TI-RTOS and drivers */
Board_initGeneral();
/* Initialize GPIO pin */
GPIO_init();
GPIO_setConfig(CT_SESR, GPIO_CFG_INPUT | GPIO_CFG_IN_INT_BOTH_EDGES);
GPIO_setCallback(CT_SESR, gpioInterruptHandler);
// /* Enable GPIO interrupt */
Hwi_Params hwiParams;
Hwi_Params_init(&hwiParams);
hwiParams.arg =CT_SESR;
hwiHandle = Hwi_create(INT_GPIOM, gpioInterruptHandler, &hwiParams, NULL);
GPIO_enableInt(CT_SESR);
/* Start TI-RTOS scheduler */
BIOS_start();
return 0;
}