Part Number: TM4C123GH6PM
Hello,
I am using UART0 and UART3 without any problem but when I try to send data using UART2 it doesn't work. I look at pin 10 (U2Tx) with an oscilloscope and I don't even see any voltage change or activity while data is sent.
It is strange because I configure the UART2 the same as UART0 and UART3.
Here is the UART2 initialization:
void UART2_Init(void)
{
//
// Enable the GPIO Peripheral used by the UART.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
//
// Enable UART2
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2);
// Wait for the UART2 module to be ready
while(!ROM_SysCtlPeripheralReady(SYSCTL_PERIPH_UART2))
{
}
//
// Configure GPIO Pins for UART mode.
//
ROM_GPIOPinConfigure(GPIO_PD6_U2RX);
ROM_GPIOPinConfigure(GPIO_PD7_U2TX);
ROM_GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_6 | GPIO_PIN_7);
//
// Configure the UART for 115,200, 8-N-1 operation.
//
ROM_UARTConfigSetExpClk(UART2_BASE, SysCtlClockGet(), 115200,
(UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE |UART_CONFIG_WLEN_8)); //115200, 9600
//
// Enable the UART operation.
//
ROM_UARTEnable(UART2_BASE);
}
In main I write a character to UART2 every second to test the port but, as I said, nothing seems to be sent:
int main(void)
{
/* Set system clock */
ROM_SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
UART0_Init();
UART2_Init();
UART3_Init();
// UART2 test
while(1){
// Write character 'A' to UART2
UARTCharPut(UART2_BASE, 'A');
timer1_wait_ms(1000); // custom function that works OK
}
}
Am I missing something?
Thanks!