Hi, I'm trying to use UART5 based on an example available in TIVAWARE examples folder. I just made some modifications on the code in order to use just what I need but I can't see any character in the serial port.
Here is my code :
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "driverlib/gpio.h"
/*variable to keep system clock*/
uint32_t g_ui32SysClock;
void UARTSend(const uint8_t *pui8Buffer, uint32_t ui32Count)
{
while(ui32Count--)
{
//
// Write the next character to the UART.
//
UARTCharPutNonBlocking(UART5_BASE, *pui8Buffer++);
}
}
int main(void)
{
/* Set the clocking to run at 120MHz */
g_ui32SysClock= SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
/*Enabling UART and GPIO for UART*/
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART5);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
/*Setting pins for UART functions*/
GPIOPinConfigure(GPIO_PC6_U5RX);
GPIOPinConfigure(GPIO_PC7_U5TX);
GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_6 | GPIO_PIN_7);
/*Setting UART5 configurations*/
UARTConfigSetExpClk(UART5_BASE,g_ui32SysClock,19200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
/*task that will repeat forever*/
while(1){
UARTSend((uint8_t *)"\033[2JEnter text: ", 16);
}
return 0;
}
I'm using a usb to serial convert similar to this one :
