Hello
I need to use UART1 Module in one application. I use Tiva TM4C123GXL Board. Thats why I activated UART1 Module. But the problem is that My code always enters to UART1_Handler and thats why my code does not enter main loop even if there are any data in RX pin of UART1 Module. The problem is same wirh UART3 Module too. But UART0 module works fine with same config
My UART initilization and Handler function in below
void UART1_Init(void) { SYSCTL_RCGCUART_R |= 0x02; // Activate UART1 SYSCTL_RCGCGPIO_R |= 0x02; // Activate port B UART1_CTL_R &= ~UART_CTL_UARTEN; // Disable UART UART1_IBRD_R = 260; UART1_FBRD_R = 27; UART1_LCRH_R = (UART_LCRH_WLEN_8 | UART_LCRH_FEN); // 8 bit word length (no parity bits, one stop bit, FIFOs) UART1_IFLS_R &= ~0x3F; // Clear TX and RX interrupt FIFO level fields // Configure interrupt for TX FIFO <= 1/8 full // Configure interrupt for RX FIFO >= 1/8 full UART1_IFLS_R += (UART_IFLS_TX1_8|UART_IFLS_RX1_8); // Enable TX and RX FIFO interrupts and RX time-out interrupt // UART1_IM_R |= (UART_IM_RXIM|UART_IM_TXIM|UART_IM_RTIM); UART1_IM_R |= (UART_IM_RXIM | UART_IM_RTIM); // UART Receive Interrupt Mask | UART Receive Time-Out Interrupt UART1_CTL_R |= UART_CTL_UARTEN; // Enable UART GPIO_PORTB_AFSEL_R |= 0x03; // Enable alt funct on PB1-0 GPIO_PORTB_DEN_R |= 0x03; // Enable digital I/O on PB1-0 GPIO_PORTB_PCTL_R = (GPIO_PORTB_PCTL_R&0xFFFFFF00)+0x00000011; // Configure PB1-0 as UART GPIO_PORTB_AMSEL_R = 0; // Disable analog functionality on PB NVIC_PRI1_R = (NVIC_PRI1_R&0xFFFF00FF)|0x00004000; // UART0=priority 2, Bits 13-15 NVIC_EN0_R = NVIC_EN0_INT6; // Enable interrupt 6 in NVIC }
void UART1_Handler(void) { if(UART1_RIS_R&UART_RIS_RXRIS) { // hardware RX FIFO >= 2 items UART1_ICR_R = UART_ICR_RXIC; // acknowledge RX FIFO , RX Interrupt Clear } }
Regards
Serkan