Hi there,
I am currently facing a problem with my EK-TM4C129EXL board where I am only able to use UART0 on the board to echo the texts that I am typing into my computer back into Putty. However, when I try to use a different UART module for the similar echoing application, (i.e. UART1 - UART7), Putty does not display anything when I start typing. I have made sure that all of my initialization are correct with respect to the UART modules and GPIO pins (through pin mux) that I am using. This is the working code that I am using for the echoing application from UART0, it is directly ripped off from a TM4C129... board's workshop code sample :
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
uint32_t ui32SysClkFreq;
int main(void)
{
ui32SysClkFreq = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTConfigSetExpClk(UART0_BASE, ui32SysClkFreq, 115200,(UART_CONFIG_WLEN_8 |
UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
UARTCharPut(UART0_BASE, 'E');
UARTCharPut(UART0_BASE, 'n');
UARTCharPut(UART0_BASE, 't');
UARTCharPut(UART0_BASE, 'e');
UARTCharPut(UART0_BASE, 'r');
UARTCharPut(UART0_BASE, ' ');
UARTCharPut(UART0_BASE, 'T');
UARTCharPut(UART0_BASE, 'e');
UARTCharPut(UART0_BASE, 'x');
UARTCharPut(UART0_BASE, 't');
UARTCharPut(UART0_BASE, ':');
UARTCharPut(UART0_BASE, ' ');
while (1)
{
if (UARTCharsAvail(UART0_BASE)) UARTCharPut(UART0_BASE, UARTCharGet(UART0_BASE));
}
}
the code above works. But, if i were to change to code to this (shown below), Putty does not display anything at all.
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
uint32_t ui32SysClkFreq;
int main(void)
{
ui32SysClkFreq = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIOPinConfigure(GPIO_PB0_U1RX);
GPIOPinConfigure(GPIO_PB1_U1TX);
GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTConfigSetExpClk(UART1_BASE, ui32SysClkFreq, 115200,(UART_CONFIG_WLEN_8 |
UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
UARTCharPut(UART1_BASE, 'E');
UARTCharPut(UART1_BASE, 'n');
UARTCharPut(UART1_BASE, 't');
UARTCharPut(UART1_BASE, 'e');
UARTCharPut(UART1_BASE, 'r');
UARTCharPut(UART1_BASE, ' ');
UARTCharPut(UART1_BASE, 'T');
UARTCharPut(UART1_BASE, 'e');
UARTCharPut(UART1_BASE, 'x');
UARTCharPut(UART1_BASE, 't');
UARTCharPut(UART1_BASE, ':');
UARTCharPut(UART1_BASE, ' ');
while (1)
{
if (UARTCharsAvail(UART1_BASE)) UARTCharPut(UART1_BASE, UARTCharGet(UART1_BASE));
}
}
I have also made sure that my COM is correct (COM4), baud rate = 115200, data bit = 8, stop bit = 1, flow control = N and parity = N on both Putty and the Stellaris Virtual Serial Port.
Please help
Regards,
Zhi Yih Lim