Other Parts Discussed in Thread: TPS2052B
Hi
i'm using TM4C1294XL evaluation board taken an reference:C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\uart_echo, uart_echo example i'm conecting to external uart into pc all setings are done in tera term but it didnt appear on the screen
My example code:
//*****************************************************************************
//
// uart_echo.c - Example for reading data from and writing data to the UART in
// an interrupt driven fashion.
//
// Copyright (c) 2013-2020 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 2.2.0.295 of the EK-TM4C1294XL Firmware Package.
//
//*****************************************************************************
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
//*****************************************************************************
//
//! \addtogroup example_list
//! <h1>UART Echo (uart_echo)</h1>
//!
//! This example application utilizes the UART to echo text. The first UART
//! (connected to the USB debug virtual serial port on the evaluation board)
//! will be configured in 115,200 baud, 8-n-1 mode. All characters received on
//! the UART are transmitted back to the UART.
//
//*****************************************************************************
//****************************************************************************
//
// System clock rate in Hz.
//
//****************************************************************************
uint32_t g_ui32SysClock;
//*****************************************************************************
//
// The error routine that is called if the driver library encounters an error.
//
//*****************************************************************************
#ifdef DEBUG
void
__error__(char *pcFilename, uint32_t ui32Line)
{
}
#endif
//*****************************************************************************
//
// The UART interrupt handler.
//
//*****************************************************************************
void
UARTIntHandler(void)
{
uint32_t ui32Status;
//
// Get the interrrupt status.
//
ui32Status = MAP_UARTIntStatus(UART2_BASE, true);
//
// Clear the asserted interrupts.
//
MAP_UARTIntClear(UART2_BASE, ui32Status);
//
// Loop while there are characters in the receive FIFO.
//
while(MAP_UARTCharsAvail(UART2_BASE))
{
//
// Read the next character from the UART and write it back to the UART.
//
MAP_UARTCharPutNonBlocking(UART2_BASE,
MAP_UARTCharGetNonBlocking(UART2_BASE));
//
// Blink the LED to show a character transfer is occuring.
//
MAP_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
//
MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0);
}
}
//*****************************************************************************
//
// Send a string to the UART.
//
//*****************************************************************************
void
UARTSend(const uint8_t *pui8Buffer, uint32_t ui32Count)
{
//
// Loop while there are more characters to send.
//
while(ui32Count--)
{
//
// Write the next character to the UART.
//
MAP_UARTCharPutNonBlocking(UART2_BASE, *pui8Buffer++);
}
}
//*****************************************************************************
//
// This example demonstrates how to send a string of data to the UART.
//
//*****************************************************************************
int
main(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);
//
// Enable the GPIO port that is used for the on-board LED.
//
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
//
// Enable the GPIO pins for the LED (PN0).
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0);
//
// Enable the peripherals used by this example.
//
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
//
// Enable processor interrupts.
//
MAP_IntMasterEnable();
//
// Set GPIO A0 and A1 as UART pins.
//
MAP_GPIOPinConfigure(GPIO_PA6_U2RX);
MAP_GPIOPinConfigure(GPIO_PA7_U2TX);
MAP_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_6 | GPIO_PIN_7);
//
// Configure the UART for 115,200, 8-N-1 operation.
//
MAP_UARTConfigSetExpClk(UART0_BASE, g_ui32SysClock, 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
//
// Enable the UART interrupt.
//
MAP_IntEnable(INT_UART2);
MAP_UARTIntEnable(UART2_BASE, UART_INT_RX | UART_INT_RT);
//
// Prompt for text to be entered.
//
UARTSend((uint8_t *)"\033[2JEnter text: ", 16);
//
// Loop forever echoing data through the UART.
//
while(1)
{
}
}