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.

CCS/TM4C123GH6PM: UART Communication between computer and TIVA C

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: EK-TM4C123GXL

Tool/software: Code Composer Studio

Hii, 

I'am manu and i'm trying UART interfacing with tiva c board. I referred number of tutorials but i cannot understand. Basically there is lot more tutorials available to send a character and to echo it in the terminal. I worked in arduino board before. its feature like, if i type a string and i need to put enter then only the data pass to the further operation in serial monitor but here it is something strange for me. how can i achieve same thing in TIVA C. 

I would like to interface SIM800l and TIVA C, to do so i should send AT commands. In below example only characters are sending and receiving. How do i know the transmission ends ? For example if i sen AT to GSM module it should response OK. how do i do that ? Please help me i'm trying this from last week 

#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"


int main(void) {
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
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, SysCtlClockGet(), 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));
}
}

  • Hello Manu,

    For what you are trying to do, have a look at our uart_echo example. This uses a UART interrupt handler to alert the MCU when a new byte is received. So you can use this to know when you receive responses from your module, and then decide what commands to send to it in return.

    The example can be found in TivaWare at: [TivaWare Install Path]\TivaWare_C_Series-2.1.4.178\examples\boards\ek-tm4c123gxl\uart_echo