Hi everyone,
I want to implement a UART monitor in a EK-TM4C1294XL Launchpad. Because I didn't find an application for Tiva C microcontrollers (except one that uses TI-RTOS, but because the application I want to use UART monitor in doesn't use TI-RTOS, I didn't want to use it), I took an application for MSP430 microcontrollers (link: processors.wiki.ti.com/.../ProgramModelUart_GuiComposer) and modified it in order to use it with the TM4C1294NCPDT microcontroller that there is on the LaunchPad. My main code is here:
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "inc/hw_ints.h"
#include "inc/hw_gpio.h"
#include "utils/ustdlib.h"
#include "driverlib/pin_map.h"
#include "utils/uartstdio.h"
#include "driverlib/uart.h"
#include "driverlib/rom.h"
#include "Serial_Cmd_Monitor.h"
//Increment variable
uint32_t count;
uint32_t ui32SystemClock;
//UART0 initialization function
void UART0Init(void)
{
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
ROM_UARTConfigSetExpClk(UART0_BASE, ui32SystemClock, 9600, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
}
//UART0 interrupt handler
void UART0IntHandler(void)
{
uint32_t ui32Status;
char getChar;
//Clear interrupt
ui32Status = ROM_UARTIntStatus(UART0_BASE, true);
ROM_UARTIntClear(UART0_BASE, ui32Status);
while(UARTCharsAvail(UART0_BASE))
{
getChar = ROM_UARTCharGetNonBlocking(UART0_BASE);
receivedDataCommand(getChar);
}
}
void main(void)
{
count = 0;
ui32SystemClock = SysCtlClockFreqSet((SYSCTL_OSC_INT|SYSCTL_USE_PLL|
SYSCTL_CFG_VCO_320), 25000000);
//Initialize UART0
UART0Init();
//Enable UART0 interrupts
ROM_IntEnable(INT_UART0);
ROM_UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
ROM_IntMasterEnable();
while(1)
{
if(count < 10000)
{
count++;
}
else
{
count = 0;
}
SysCtlDelay(1000000);
}
}
Also, in the Serial_Cmd_Monitor.c file (that contains the functions for the UART monitor) I changed the function Write8bitByteToCOM() (the function that sends data to the PC) from:
void Write8bitByteToCOM(unsigned char c)
{
uartTxByte(c & 0xff);
}
to:
void Write8bitByteToCOM(uint32_t ui32Base, unsigned char c)
{
while(UARTSpaceAvail(ui32Base))
{
UARTCharPutNonBlocking(ui32Base, c & 0xff);
}
}
in order to use with my Launchpad.
When I debug the project and try to see a variable in an expression box I get the following error:
ComPort: Trouble Writing Memory Block at 0x20000244 on Page 0 of Length 0x4: **Error**: Serial Communication failed at port: COM5, baud rate:9600! To use serial monitor, please ensure the following prerequisites are satisfied: 1. Make sure the cable is plugged into both the target and the host on the right COM port. 2. Make sure a compatible target side serial monitor is loaded and running on the target device.
What am I doing wrong?
I use CCS6.1 on a Windows 10 (64-bit) machine.
My whole project is attached here: tm4c_uart_monitor.zip