Other Parts Discussed in Thread: TM4C123GH6PM, MAX232
Hi,
I modified the uart_echo example for uart7. But it is not working. I saw many other posts related to that, but i can't get any output. Help me to resolve the problem. 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 "driverlib/debug.h"
#include "driverlib/fpu.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#ifdef DEBUG
void
__error__(char *pcFilename, unsigned long ulLine)
{
}
#endif
void
UARTIntHandler(void)
{
unsigned long ulStatus;
ulStatus = UARTIntStatus(UART7_BASE, true);
UARTIntClear(UART7_BASE, ulStatus);
while(ROM_UARTCharsAvail(UART7_BASE))
{
ROM_UARTCharPutNonBlocking(UART7_BASE,
ROM_UARTCharGetNonBlocking(UART7_BASE));
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);
SysCtlDelay(SysCtlClockGet() / (1000 * 3));
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0);
}
}
void
UARTSend(const unsigned char *pucBuffer, unsigned long ulCount)
{
while(ulCount--)
{
ROM_UARTCharPutNonBlocking(UART7_BASE, *pucBuffer++);
}
}
int
main(void)
{
ROM_FPUEnable();
ROM_FPULazyStackingEnable();
ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2);
SysCtlPeripheralDisable(SYSCTL_PERIPH_UART0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART7);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPinTypeUART(GPIO_PORTE_BASE, GPIO_PIN_0);
GPIOPinConfigure(GPIO_PE0_U7RX);
GPIOPinTypeUART(GPIO_PORTE_BASE, GPIO_PIN_1);
GPIOPinConfigure(GPIO_PE1_U7TX);
ROM_UARTConfigSetExpClk(UART7_BASE, ROM_SysCtlClockGet(), 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
IntEnable(INT_UART7);
UARTIntDisable(UART7_BASE,UART_INT_TX);
UARTIntEnable(UART7_BASE, UART_INT_RX | UART_INT_RT);
IntMasterEnable();
UARTSend((unsigned char *)"\033[2JEnter text: %d", 16);
while(1)
{
}
}