Other Parts Discussed in Thread: TM4C123GH6PM
I tried to modify the uart_echo example to use UART2. However, nothing comes out on UART2. I verified this with an oscilloscope. In fact, none of the UARTs work except UART0 which does work. I read in another post that I need to turn on the gated clocks to the UARTs by writing to the RCGCUART register at 0x400fe618, but that didn't help. I also changed the interrupt table in startup_rvmdk.S to handle an interrupt on UART2. According to the debugger, the code gets to the while loop at the end, which means it's not off in the weeds somewhere.
The relevant portion of my code is shown below. Can anyone please help? TIA.
...
// set RCGCUART
volatile uint32_t value=0;
value = (*((volatile uint32_t *)0x400FE618));
(*((volatile uint32_t *)0x400FE618)) = 0x000f;
value = (*((volatile uint32_t *)0x400FE618));
//
// Enable the peripherals used by this example.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2);
//
// Enable processor interrupts.
//
ROM_IntMasterEnable();
//
// Set GPIO A0 and A1 as UART pins.
//
ROM_GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_6);
ROM_GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_7);
//
// Configure the UART for 115,200, 8-N-1 operation.
//
ROM_UARTConfigSetExpClk(UART2_BASE, ROM_SysCtlClockGet(), 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
//
// Enable the UART interrupt.
//
ROM_IntEnable(INT_UART2);
ROM_UARTIntEnable(UART2_BASE, UART_INT_RX | UART_INT_RT);
//
// Prompt for text to be entered.
//
UARTSend((uint8_t *)"Enter text: ", 12);
//
// Loop forever echoing data through the UART.
//
while(1)
{
}
...