Other Parts Discussed in Thread: EK-TM4C129EXL
Tool/software: TI C/C++ Compiler
Hello Gurus,
I am trying to implement UART0 RX interrupt and can not implement yet. The code compiles successfully without any error. However I am facing two weird problems i.e;
- It doesnt capture any interrupt till I send the 8th character. As it receives the 8th character it services the interrupt handler ISR and returns back sucessfully
- It services the interrupt only once and never interrupts again no matter how many charter I send.
I have registered the interrupt handler in startup_css.c file already and declared as well.
//***************************************************************************** // // External declarations for the interrupt handlers used by the application. // //***************************************************************************** extern void xPortPendSVHandler(void); extern void vPortSVCHandler(void); extern void xPortSysTickHandler(void); extern void UART0ISR(void); //*****************************************************************************
AND
IntDefaultHandler, // GPIO Port B IntDefaultHandler, // GPIO Port C IntDefaultHandler, // GPIO Port D IntDefaultHandler, // GPIO Port E UART0ISR, // UART0 Rx and Tx IntDefaultHandler, // UART1 Rx and Tx IntDefaultHandler, // SSI0 Rx and Tx IntDefaultHandler, // I2C0 Master and Slave
My main.c;
#include <stdint.h> #include <stdbool.h> #include "main.h" #include "drivers/pinout.h" #include "utils/uartstdio.h" // TivaWare includes #include "driverlib/sysctl.h" #include "driverlib/debug.h" #include "driverlib/rom.h" #include "driverlib/rom_map.h" #include "driverlib/gpio.h" #include "inc/hw_memmap.h" #include "driverlib/pin_map.h" #include "driverlib/uart.h" #include "inc/hw_ints.h" #include "driverlib/interrupt.h" // FreeRTOS includes #include "FreeRTOSConfig.h" #include "FreeRTOS.h" #include "task.h" #include "queue.h" // Tasks declarations void LED1Task(void *pvParameters); void LED2Task(void *pvParameters); void LED3Task(void *pvParameters); void LED4Task(void *pvParameters); void SerialTask1(void *pvParameters); void SerialTask2(void *pvParameters); void UART0ISR(void); // Main function int main(void) { // Initialize system clock to 120 MHz uint32_t output_clock_rate_hz; output_clock_rate_hz = ROM_SysCtlClockFreqSet( (SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), SYSTEM_CLOCK); ASSERT(output_clock_rate_hz == SYSTEM_CLOCK); // Initialize the GPIO pins for the Launchpad PinoutSet(false, false); // Set up the UART which is connected to the virtual COM port //UARTStdioInit(0); //UARTStdioConfig(0, 115200, SYSTEM_CLOCK); ///////////////////////////////////////////////////////////////////////////// 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, output_clock_rate_hz, 115200,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); UARTIntEnable(UART0_BASE, UART_INT_RX); //only enable RX interrupts //IntRegister(INT_UART0, UART0ISR); IntEnable(INT_UART0); //enable the UART interrupt IntMasterEnable(); //enable processor interrupts UARTStdioConfig(0, 115200, SYSTEM_CLOCK); //////////////////////////////////////////////////////////////////////////// // Create demo tasks xTaskCreate(LED1Task, (const portCHAR *)"LED1", configMINIMAL_STACK_SIZE, NULL, 1, NULL); //xTaskCreate(demoLED2Task, (const portCHAR *)"LED2", //configMINIMAL_STACK_SIZE, NULL, 1, NULL); xTaskCreate(LED3Task, (const portCHAR *)"LED3", configMINIMAL_STACK_SIZE, NULL, 1, NULL); //xTaskCreate(LED4Task, (const portCHAR *)"LED4", //configMINIMAL_STACK_SIZE, NULL, 1, NULL); xTaskCreate(SerialTask1, (const portCHAR *)"SerialTask1", configMINIMAL_STACK_SIZE, NULL, 1, NULL); xTaskCreate(SerialTask2, (const portCHAR *)"SerialTask2", configMINIMAL_STACK_SIZE, NULL, 1, NULL); vTaskStartScheduler(); /// Scheduler should NEVER reach here/// while(1) { //UARTprintf("Scheduler Error..!\n\r"); GPIOPinWrite(CLP_D1_PORT, CLP_D1_PIN, CLP_D1_PIN); GPIOPinWrite(CLP_D2_PORT, CLP_D2_PIN, CLP_D2_PIN); GPIOPinWrite(CLP_D3_PORT, CLP_D3_PIN, CLP_D3_PIN); GPIOPinWrite(CLP_D4_PORT, CLP_D4_PIN, CLP_D4_PIN); return 0; } }
and the UART0 handler defination;
void UART0ISR(void) { UARTIntClear(UART0_BASE, UART_INT_RX); UARTprintf("UART0ISR called..!\n\r"); }
I am stuck and not able to identify the issue.
Any help/hint will be appreciable.
Thank you all.