Tool/software: TI-RTOS
Hello,
I am trying to implement a UART interrupt in TIRTOS for the TM4C1294NCPDT controller and am getting stuck when trying to register an interrupt handler.
My init function in EK_TM4C1294XL.c:
/*
* ======== EK_TM4C1294XL_initUART ========
*/
void EK_TM4C1294XL_initUART(void)
{
/* UART 0 */
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTConfigSetExpClk(UART0_BASE, 120000000, 9600,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
/* Initialize the UART driver */
#if TI_DRIVERS_UART_DMA
EK_TM4C1294XL_initDMA();
#endif
UART_init();
/* Enables UART FIFO */
UARTFIFOEnable(UART0_BASE);
/* Set RX FIFO interrupt at maximum and TX interrupt at minimum */
UARTFIFOLevelSet(UART0_BASE, UART_FIFO_RX7_8, UART_FIFO_TX1_8);
/* Bind interrupt handler function */
UARTIntRegister(UART0_BASE, UART0InterruptHandler);
/* Enable the interrupt */
UARTIntEnable(UART0_BASE, UART_INT_RX);
}
The UART0InterruptHandler function is defined elsewhere:
void UART0InterruptHandler(void){
uint32_t intStatus = UARTIntStatus(UART0_BASE, false); //false = 0
UARTIntClear(UART0_BASE, UART_INT_RX);
UARTIntDisable(UART0_BASE, UART_INT_RX);
if(intStatus & UART_INT_RX){ //Rx interrupt
while(UARTCharsAvail(UART0_BASE)){
UART_buffer[UART_buffer_index] = UARTCharGet(UART0_BASE); //extract chars one by one
UART_buffer_index++;
}
}
return;
}
The issue is that when I try to run the code with the UARTIntRegister function included, as soon as the code is loaded into the controller (even before I hit run) the controller runs to the loader_exit function and the console displays the following message:
FSR = 0x0000
HFSR = 0x40000000
DFSR = 0x00000008
MMAR = 0x00016400
BFAR = 0x00016400
AFSR = 0x00000000
Terminating execution...
If I do not include the UARTIntRegister function, everything works fine (no interrupts, obviously.) What am I doing wrong? Is there a global interrupt that I am not enabling somewhere? Or, do I need to make some changes in the .cfg file for this to work?
Thank you,
svl123