This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

EK-TM4C123GXL: UART0 can echo to Tera Term, other UART can't.

Part Number: EK-TM4C123GXL

To test my UART setup I wanted to just print to Tera Term, it will work if i use UART0, obviously on Port A, pins 0 and 1, but if i change the code to be UART4 for example, and change the mask values and registers so its Port C, pins 4 and 5, characters wont print to Tera Term. I've included my code, am i missing something?

int main(void)
{

UARTM();
// UARTJ();
char c;
while(1){
c = ReadChar();
WriteChar(c);

}
}

char ReadChar(void)
{
char c;
while ((UART4_FR & 0x10) == 0x10){};
c = UART4_DR;
return c;
}

void WriteChar(char c)
{
while ((UART4_FR & 0x20) == 0x20){};
UART4_DR = c;
}


void UARTJ (void)
{
SYSCTL_RCGUART |= 1;
while ((SYSCTL_PRUART & 1) != 1);

UART0_CTL &= ~0x21;
UART0_IBRD = 17;
UART0_FBRD = 23;
UART0_LCRH &= ~0xE;
UART0_LCRH |= 0x60;
UART0_CTL |= 0x301;

SYSCTL_RCGCGPIO |= 1;
while ((SYSCTL_PRGPIO & 1) != 1);

GPIOA_DIR &= ~0x1;
GPIOA_PUR |= 0x1;
GPIOA_DIR |= 0x2;
GPIOA_DEN |= 0x3;
GPIOA_AFSEL |= 0x3;
GPIOA_PCTL &= ~0xFF;
GPIOA_PCTL |= 0x11;

}

void UARTM (void)
{
SYSCTL_RCGUART |= 0x10;
while ((SYSCTL_PRUART & 0x10) != 0x10);

UART4_CTL &= ~21;
UART4_IBRD = 17;
UART4_FBRD = 23;
UART4_LCRH &= ~0xE; //57600 Baud Rate, 8 data bits, no parity, 1 stop bit, 16 bit prescaler
UART4_LCRH |= 0x60;
UART4_CTL |= 0x301;

SYSCTL_RCGCGPIO |= 0x4;
while ((SYSCTL_PRGPIO & 0x4) != 0x4);

GPIOC_DIR &= ~ 0x10;
GPIOC_PUR |= 0x10;
GPIOC_DIR |= 0x20;
GPIOC_DEN |= 0x30;
GPIOC_AFSEL |= 0x30;
GPIOC_PCTL &= ~0xFF0000;
GPIOC_PCTL |= 0x110000;
}

  • Hi,

     On the EK-TM4C123GXL LaunchPad, only the UART0 is connected to the PC for virtual COM port enumeration. See the EK-TM4C123GXL User's guide for detail. Below is the excerpt. If you want to other UARTx for Virtual COM port you will need to have a separate USB-to-Serial adapter.