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.

SW-EK-TM4C129EXL: EK-TM4C129EXL

Part Number: SW-EK-TM4C129EXL
Other Parts Discussed in Thread: EK-TM4C129EXL, TM4C129ENCPDT

Dear all,

I use UART2 (PA6 as  Tx and PA7 as Rx). I send a data stream like 17, 03, 04, 34, 45, 65 to another board(Arduino Mega). It was successfully work. But when I send same data and then this data is received my ek-tm4c129exl , there is a problem. Because I want to show this receive data in console. I use UART0 as console. But I didn't show the anything in console. My code is--


#include <stdint.h>
#include <stdbool.h>

#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/tm4c129encpdt.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/uart.h"
#include "driverlib/interrupt.h"
#include "utils/uartstdio.h"

/*
* ---------------SYSTEM Clock Rate--------------
*/

uint32_t g_ui32SysClock;

void MB_Port(void)
{
// Run from the PLL at 120 MHz.
// Note: SYSCTL_CFG_VCO_240 is a new setting provided in TivaWare 2.2.x and
// later to better reflect the actual VCO speed due to SYSCTL#22.
//
g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_240), 120000000);

MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

MAP_GPIOPinConfigure(GPIO_PA6_U2RX);
MAP_GPIOPinConfigure(GPIO_PA7_U2TX);
MAP_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_6 | GPIO_PIN_7);

//----------------Baud Rate setup 9600bps---------------
MAP_UARTConfigSetExpClk(UART2_BASE, g_ui32SysClock, 9600,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));

}

/*
* --------------------Console function-----------------
*/
void
InitConsole(void)
{
//
// Enable GPIO port A which is used for UART0 pins.
// TODO: change this to whichever GPIO port you are using.
//
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

//
// Configure the pin muxing for UART0 functions on port A0 and A1.
// This step is not necessary if your part does not support pin muxing.
// TODO: change this to select the port/pin you are using.
//
MAP_GPIOPinConfigure(GPIO_PA0_U0RX);
MAP_GPIOPinConfigure(GPIO_PA1_U0TX);

//
// Enable UART0 so that we can configure the clock.
//
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);

//
// Use the internal 16MHz oscillator as the UART clock source.
//
MAP_UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);

//
// Select the alternate (UART) function for these pins.
// TODO: change this to select the port/pin you are using.
//
MAP_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

//
// Initialize the UART for console I/O.
//
UARTStdioConfig(0, 9600, g_ui32SysClock);
}


/**
* main.c
*/
int main(void)
{

unsigned int j=0;
unsigned int data_in[j],a[6]={17,03,34,25,65,45};

MB_Port();
InitConsole();

for(i=0;i<6;i++)
{
MAP_UARTCharPut(UART2_BASE,a[i]);
}
while(1)
{
while(MAP_UARTCharsAvail(UART0_BASE))
{
data_in[j] = (unsigned int)MAP_UARTCharGetNonBlocking(UART0_BASE);
UARTprintf("Ack data is %d", data_in[j]);
j++;
}
}