I have a couple questions about UART. Previously I set this up and working with DRM, but now I am trying to replicate it with TivaWare.
1. For my interrupts, I need to set Tx to End of Transmit (EOT), and Rx to trigger when a single data byte is received in the Rx Fifo. I set the TxIntMode to EOT, but then I have to use the FifoLevelSet function to set the RX interrupt level to one byte. This requires me to write a trigger level to the TX Fifo even though I want this in EOT mode. Will this overwrite my Tx EOT mode set?
2. When I programmed UART in DRM, there was no function to call to link an ISR function to an interrupt. I went into the startup_rvmdk file and wrote in the ISR, linking the ISR function to the interrupt there. But now I see this UARTIntRegister function which links a function to my uart interrupt. Do I still need to edit the startup_rvmdk file?
Thanks! Here's my init code so far if you care to take a look.
void uart_init(){
//initializes UART1
//sets up transmit and receive interrupts
//0. Init Clock to UART and PortC
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
//Give it time for clocks to start
SysCtlDelay(10);
//Disable UART before programming
UARTDisable(UART1_BASE);
//1. set baud rate, txe/rxe, stp2 (clear then and fen), and wlen (8 bit_
UARTConfigSetExpClk(UART1_BASE, SysCtlClockGet(), 9600, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
UARTFIFOEnable(UART1_BASE);
//1.5. Set up AFSEL To C4, C5
GPIOPinConfigure(GPIO_PC4_U1RX);
GPIOPinConfigure(GPIO_PC5_U1TX);
//Set C4 as Input (RX) and C5 as Output (TX)
GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, GPIO_PIN_5);
GPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_4);
//Enable Global NVIC Interrupt
IntEnable(INT_UART1);
//Enable Local Interrupts
UARTIntEnable(UART1_BASE, (UART_INT_TX | UART_INT_RX)); //enable Tx and Rx int
UARTTxIntModeSet(UART1_BASE, UART_TXINT_MODE_EOT); //set Tx mode to EOT
UARTFIFOLevelSet(UART1_BASE, UART_FIFO_TX1_8, UART_FIFO_RX1_8); //set Rx to trigger with one byte
//Disable for now so I don't get stuck in the TX isr.
UARTIntDisable(UART1_BASE, UART_INT_TX);
//Link a function to the UART Interrupt
UARTIntRegister(UART1_BASE, isr_uart1);
//Enable UART1
UARTEnable(UART1_BASE);
}