Tool/software: Code Composer Studio
hi i am trying to send the packet array {0x01,0x02,0x03,0x04,0x05} using uart 7 of tiva
but i received in ccs terminal incorrect values
here is my code
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "inc/hw_memmap.h"
#include "inc/hw_uart.h"
#include "inc/hw_types.h"
#include "driverlib/fpu.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
//*****************************************************************************
//
// Macros used in this application.
//
//*****************************************************************************
#define NUM_UART_DATA 5
uint8_t ui8DataTx[NUM_UART_DATA]={0x01,0x02,0x03,0x04,0x05};
uint32_t ui32index;
//*****************************************************************************
//
// The error routine that is called if the driver library encounters an error.
//
//*****************************************************************************
#ifdef DEBUG
void
__error__(char *pcFilename, uint32_t ui32Line)
{
}
#endif
//*****************************************************************************
//
// Send a string to the UART. This function sends a string of characters to a
// particular UART module.
//
//*****************************************************************************
void
UARTSend( uint8_t *pui8Buffer, uint32_t ui32Count)
{
//
// Loop while there are more characters to send.
//
while(ui32Count--)
{
while(!(ROM_UARTSpaceAvail(UART7_BASE))); // return true if there is space , return false if there is no space
ROM_UARTCharPutNonBlocking(UART7_BASE, *pui8Buffer++); // wait until character is transmitted
}
}
//*****************************************************************************
//
// Configue UART in internal loopback mode and tranmsit and receive data
// internally.
//
//*****************************************************************************
int
main(void)
{
uint32_t ui32SysClock;
//
// Set the clocking to run directly from the crystal.
ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN |
SYSCTL_USE_OSC), 25000000);
//
// Enable the peripherals used by this example.
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART7);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
GPIOPinConfigure(GPIO_PC4_U7RX);
GPIOPinConfigure(GPIO_PC5_U7TX);
ROM_GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5);
//
// Configure the UART for 115,200, 8-N-1 operation.
ROM_UARTConfigSetExpClk(UART7_BASE, ui32SysClock, 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
//
// ROM_UARTFIFOEnable(UART7_BASE);
UARTSend( ui8DataTx, NUM_UART_DATA);
while(1);
}