Part Number: EK-TM4C129EXL
Other Parts Discussed in Thread: TM4C129ENCPDT
Tool/software: Code Composer Studio
Hi,
I am using EK-TM4C129EXL evaluation kit with CCS 7.0
I need to transmit a paragraph (char array) from my PC to controller and vice versa. For that, I have planned to use UART communication.
To start with UART communication, I checked the uart_echo example. The code inside UART interrupt handler goes like this :
while(ROM_UARTCharsAvail(UART0_BASE))
{
//
// Read the next character from the UART and write it back to the UART.
//
ROM_UARTCharPutNonBlocking(UART0_BASE,ROM_UARTCharGetNonBlocking(UART0_BASE));
/* commented
//
// Blink the LED to show a character transfer is occuring.
//
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, GPIO_PIN_0);
//
// Delay for 1 millisecond. Each SysCtlDelay is about 3 clocks.
//
SysCtlDelay(g_ui32SysClock / (1000 * 3));
//
// Turn off the LED
//
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0);
*/
}
At first, when I send a paragraph, only 16 to 18 characters are echoed back and printed on the console screen.
Then I removed the LED blinking logic, which blinks on reception of every char by commenting it. Now the whole paragraph gets echoed and printed irrespective of the size of the paragraph. Works perfectly.
The problem is if I try to store the incoming characters in a char array once again only 16 - 18 gets stored and very unreliable. I use the following code inside the while loop to store the incoming data in a buffer.
buf[i++] = ROM_UARTCharGetNonBlocking(UART0_BASE);
I need to collect the data and process it in the main function.
Some suggest going for the Buffered operation. I even tried that with UARTgets() function. I cannot achieve it.
A programming example for buffered UART operation or examples with UARTgets() function would be a great help. Or can I achieve it without going for the Buffered operation?
Note: The paragraph will be sent from my PC completely in one stretch.
Thank You for your time.
