This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MPU9150 Example code + UART5 gives error

Dear All,


I am trying to debug my code that had not been working for more than two weeks and I am a little frustrated. I hope to seek help on this forum.
I am using the TIVA123GH6PM Launchpad with the Sensor Hub Boosterpack.  My intension is to monitor readings of the X,Y,Z  readings of the accelerometer and send them to my Amazon Instance which is running a server. I am using CCS latest version and I wish to attach my code below.


I believe its the best to post the code rather than attaching the same as a .rar file. I apologize if it cause someone trouble.

I have two problems.

1. my code goes into MPU9150AppErrorHandler () a lot and keeps the RED LED ON.

2. There is a mysterious behavior by the example code that if I not comment out the ConnectToServer (); function the example code always goes into MPU9150AppErrorHandler ().  I have noted it is always because g_vui8ErrorFlag returns true.

SystemInit () initializes UART0, and UART5 and interrupts nothing else and I am not tampering any other peripheral other than those. 

ConnectToServer () only passes characters via UART0 and UART5. I believe it is enough to know about for a 3rd person in debugging this code.  But here is more information about the same.

ConnectToServer () function is used to pass commands to my GSM Module to connect to a server. Once connected, that function can be commented out and when it is commented the Example Code works just fine except for random  errors I get going into the MPU9150AppErrorHandler ().  I was initially using UART1 to configure the GSM module. I thought it might be messing with Sensor Hub Boosterpack there for I changed to UART5. I still had both errors. Therefore I physically bent the pins off the launchpad and now there is not way my UART RX,TX are connected to the Sensor Hub Boosterpack. Sadly, my issue persists after weeks of debugging. I am a little frustrated and in need of help. I will try my best to provide required information below and I have missed, please be kind enough to ask.

This system will be monitoring the motion of an elephant. This device is expected to work once deployed and tampering it for resetting etc is not very difficult. This is why I want to eliminate random errors to my best.  Please be kind enough to help.


As per the organization rules kindly note I have edited server IP.

Main file :

#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_ints.h"
#include "driverlib/debug.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"
#include "utils/uartstdio.h"
#include "sensorlib/hw_mpu9150.h"
#include "sensorlib/hw_ak8975.h"
#include "sensorlib/i2cm_drv.h"
#include "sensorlib/ak8975.h"
#include "sensorlib/mpu9150.h"
#include "sensorlib/comp_dcm.h"
#include "drivers/rgb.h"
#include "general.h"
#include "math.h"

#define DIM(x) (sizeof(x)/sizeof((x)[0]))

//*****************************************************************************
//
// Define MPU9150 I2C Address.
//
//*****************************************************************************
#define MPU9150_I2C_ADDRESS     0x68

//*****************************************************************************
//
// Global array for holding the color values for the RGB.
//
//*****************************************************************************
uint32_t g_pui32Colors[3];

//*****************************************************************************
//
// Global instance structure for the I2C master driver.
//
//*****************************************************************************
tI2CMInstance g_sI2CInst;

//*****************************************************************************
//
// Global instance structure for the ISL29023 sensor driver.
//
//*****************************************************************************
tMPU9150 g_sMPU9150Inst;

//*****************************************************************************
//
// Global Instance structure to manage the DCM state.
//
//*****************************************************************************
tCompDCM g_sCompDCMInst;

//*****************************************************************************
//
// Global flags to alert main that MPU9150 I2C transaction is complete
//
//*****************************************************************************
volatile uint_fast8_t g_vui8I2CDoneFlag;

//*****************************************************************************
//
// Global flags to alert main that MPU9150 I2C transaction error has occurred.
//
//*****************************************************************************
volatile uint_fast8_t g_vui8ErrorFlag;

//*****************************************************************************
//
// Global flags to alert main that MPU9150 data is ready to be retrieved.
//
//*****************************************************************************
volatile uint_fast8_t g_vui8DataFlag;

//*****************************************************************************
//
// Global counter to control and slow down the rate of data to the terminal.
//
//*****************************************************************************
#define PRINT_SKIP_COUNT        7 //10 by original

uint32_t g_ui32PrintSkipCounter;

//*****************************************************************************
//
// The error routine that is called if the driver library encounters an error.
//
//*****************************************************************************
#ifdef DEBUG
void
__error__(char *pcFilename, uint32_t ui32Line)
{
}
#endif

//*****************************************************************************
//
// MPU9150 Sensor callback function.  Called at the end of MPU9150 sensor
// driver transactions. This is called from I2C interrupt context. Therefore,
// we just set a flag and let main do the bulk of the computations and display.
//
//*****************************************************************************
void
MPU9150AppCallback(void *pvCallbackData, uint_fast8_t ui8Status)
{
    //
    // If the transaction succeeded set the data flag to indicate to
    // application that this transaction is complete and data may be ready.
    //
    if(ui8Status == I2CM_STATUS_SUCCESS)
    {
        g_vui8I2CDoneFlag = 1;
    }

    //
    // Store the most recent status in case it was an error condition
    //
    g_vui8ErrorFlag = ui8Status;
}

//*****************************************************************************
//
// Called by the NVIC as a result of GPIO port B interrupt event. For this
// application GPIO port B pin 2 is the interrupt line for the MPU9150
//
//*****************************************************************************
void
IntGPIOb(void)
{
    unsigned long ulStatus;

    ulStatus = GPIOIntStatus(GPIO_PORTB_BASE, true);

    //
    // Clear all the pin interrupts that are set
    //
    GPIOIntClear(GPIO_PORTB_BASE, ulStatus);

    if(ulStatus & GPIO_PIN_2)
    {
        //
        // MPU9150 Data is ready for retrieval and processing.
        //
        MPU9150DataRead(&g_sMPU9150Inst, MPU9150AppCallback, &g_sMPU9150Inst);
    }
}

//*****************************************************************************
//
// Called by the NVIC as a result of I2C3 Interrupt. I2C3 is the I2C connection
// to the MPU9150.
//
//*****************************************************************************
void
MPU9150I2CIntHandler(void)
{
    //
    // Pass through to the I2CM interrupt handler provided by sensor library.
    // This is required to be at application level so that I2CMIntHandler can
    // receive the instance structure pointer as an argument.
    //
    I2CMIntHandler(&g_sI2CInst);
}

//*****************************************************************************
//
// MPU9150 Application error handler. Show the user if we have encountered an
// I2C error.
//
//*****************************************************************************
void
MPU9150AppErrorHandler(char *pcFilename, uint_fast32_t ui32Line)
{
    //
    // Set terminal color to red and print error status and locations
    //
   // UARTprintf("\033[31;1m");
   // UARTprintf("Error: %d, File: %s, Line: %d\n"
          //     "See I2C status definitions in sensorlib\\i2cm_drv.h\n",
            //   g_vui8ErrorFlag, pcFilename, ui32Line);

    //
    // Return terminal color to normal
    //
  //  UARTprintf("\033[0m");

	UARTCharPut(UART0_BASE,'E');
	UARTCharPut(UART0_BASE,'R');
	UARTCharPut(UART0_BASE,'R');
	UARTCharPut(UART0_BASE,'O');
	UARTCharPut(UART0_BASE,'R');
	UARTCharPut(UART0_BASE,'\n');

    //
    // Set RGB Color to RED
    //
    g_pui32Colors[0] = 0xFFFF;
    g_pui32Colors[1] = 0;
    g_pui32Colors[2] = 0;
    RGBColorSet(g_pui32Colors);

    //
    // Increase blink rate to get attention
    //
    RGBBlinkRateSet(10.0f);

    //
    // Go to sleep wait for interventions.  A more robust application could
    // attempt corrective actions here.
    //
    while(1)
    {
        //
        // Do Nothing
        //
    }
}

//*****************************************************************************
//
// Function to wait for the MPU9150 transactions to complete. Use this to spin
// wait on the I2C bus.
//
//*****************************************************************************
void
MPU9150AppI2CWait(char *pcFilename, uint_fast32_t ui32Line)
{
    //
    // Put the processor to sleep while we wait for the I2C driver to
    // indicate that the transaction is complete.
    //
    while((g_vui8I2CDoneFlag == 0) && (g_vui8ErrorFlag == 0))
    {
        //
        // Do Nothing
        //
    }

    //
    // If an error occurred call the error handler immediately.
    //
    if(g_vui8ErrorFlag)
    {
        MPU9150AppErrorHandler(pcFilename, ui32Line);
    }

    //
    // clear the data flag for next use.
    //
    g_vui8I2CDoneFlag = 0;
}

//*****************************************************************************
//
// Configure the UART and its pins.  This must be called before UARTprintf().
//
//*****************************************************************************
void
ConfigureUART(void)
{
    //
    // Enable the GPIO Peripheral used by the UART.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

    //
    // Enable UART0
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);

    //
    // Configure GPIO Pins for UART mode.
    //
    ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
    ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
    ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    //
    // Use the internal 16MHz oscillator as the UART clock source.
    //
    UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);

    //
    // Initialize the UART for console I/O.
    //
    UARTStdioConfig(0, 115200, 16000000);
}

//*****************************************************************************
//
// Main application entry point.
//
//*****************************************************************************
int
main(void)
{

    float pfData[3];
    float *pfAccel;
    	int z;
        char SendBuffer[100];
        char *loc = SendBuffer;
        size_t tempLen;

    //
    // Initialize convenience pointers that clean up and clarify the code
    // meaning. We want all the data in a single contiguous array so that
    // we can make our pretty printing easier later.
    //
    pfAccel = pfData;


    //
    // Setup the system clock to run at 40 Mhz from PLL with crystal reference
    //
    ROM_SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ |
                       SYSCTL_OSC_MAIN);


    //
    // Initialise SIM908 System
    //
    SystemInit ();
    ConnectToServer ();

    ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_I2C3);
    //
    // Enable port B used for motion interrupt.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);



    //
    // Set the color to a purple approximation.
    //
    g_pui32Colors[RED] = 0x8000;
    g_pui32Colors[BLUE] = 0x8000;
    g_pui32Colors[GREEN] = 0x0000;

    //
    // Initialize RGB driver.
    //
    RGBInit(0);
    RGBColorSet(g_pui32Colors);
    RGBIntensitySet(0.1f);
    RGBEnable();

    //
    // The I2C3 peripheral must be enabled before use.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C3);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);

    //
    // Configure the pin muxing for I2C3 functions on port D0 and D1.
    //
    ROM_GPIOPinConfigure(GPIO_PD0_I2C3SCL);
    ROM_GPIOPinConfigure(GPIO_PD1_I2C3SDA);

    //
    // Select the I2C function for these pins.  This function will also
    // configure the GPIO pins pins for I2C operation, setting them to
    // open-drain operation with weak pull-ups.  Consult the data sheet
    // to see which functions are allocated per pin.
    //
    ROM_GPIOPinTypeI2CSCL(GPIO_PORTD_BASE, GPIO_PIN_0);
    ROM_GPIOPinTypeI2C(GPIO_PORTD_BASE, GPIO_PIN_1);

    //
    // Configure and Enable the GPIO interrupt. Used for INT signal from the
    // MPU9150
    //
    ROM_GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_2);
    GPIOIntEnable(GPIO_PORTB_BASE, GPIO_PIN_2);
    ROM_GPIOIntTypeSet(GPIO_PORTB_BASE, GPIO_PIN_2, GPIO_FALLING_EDGE);
    ROM_IntEnable(INT_GPIOB);

    //
    // Keep only some parts of the systems running while in sleep mode.
    // GPIOB is for the MPU9150 interrupt pin.
    // UART0 is the virtual serial port
    // TIMER0, TIMER1 and WTIMER5 are used by the RGB driver
    // I2C3 is the I2C interface to the ISL29023
    //
    ROM_SysCtlPeripheralClockGating(true);
    ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOB);
    ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UART0);
    ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UART5);
  //  ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_TIMER0);
    //ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_TIMER1);
    ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_I2C3);
    //ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_WTIMER5);

    //
    // Enable interrupts to the processor.
    //
    ROM_IntMasterEnable();



    //
    // Initialize I2C3 peripheral.
    //
    I2CMInit(&g_sI2CInst, I2C3_BASE, INT_I2C3, 0xff, 0xff,
             ROM_SysCtlClockGet());

    //
    // Initialize the MPU9150 Driver.
    //
    MPU9150Init(&g_sMPU9150Inst, &g_sI2CInst, MPU9150_I2C_ADDRESS,
                MPU9150AppCallback, &g_sMPU9150Inst);

    //
    // Wait for transaction to complete
    //
    MPU9150AppI2CWait(__FILE__, __LINE__);

    //
    // Write application specifice sensor configuration such as filter settings
    // and sensor range settings.
    //
    g_sMPU9150Inst.pui8Data[0] = MPU9150_CONFIG_DLPF_CFG_94_98;
    g_sMPU9150Inst.pui8Data[1] = MPU9150_GYRO_CONFIG_FS_SEL_250;
    g_sMPU9150Inst.pui8Data[2] = (MPU9150_ACCEL_CONFIG_ACCEL_HPF_5HZ |
                                  MPU9150_ACCEL_CONFIG_AFS_SEL_2G);
    MPU9150Write(&g_sMPU9150Inst, MPU9150_O_CONFIG, g_sMPU9150Inst.pui8Data, 3,
                 MPU9150AppCallback, &g_sMPU9150Inst);

    //
    // Wait for transaction to complete
    //
    MPU9150AppI2CWait(__FILE__, __LINE__);

    //
    // Configure the data ready interrupt pin output of the MPU9150.
    //
    g_sMPU9150Inst.pui8Data[0] = MPU9150_INT_PIN_CFG_INT_LEVEL |
                                    MPU9150_INT_PIN_CFG_INT_RD_CLEAR |
                                    MPU9150_INT_PIN_CFG_LATCH_INT_EN;
    g_sMPU9150Inst.pui8Data[1] = MPU9150_INT_ENABLE_DATA_RDY_EN;
    MPU9150Write(&g_sMPU9150Inst, MPU9150_O_INT_PIN_CFG,
                 g_sMPU9150Inst.pui8Data, 2, MPU9150AppCallback,
                 &g_sMPU9150Inst);

    //
    // Wait for transaction to complete
    //
    MPU9150AppI2CWait(__FILE__, __LINE__);


    //
    // Enable blinking indicates config finished successfully
    //
    RGBBlinkRateSet(1.0f);






    while(1)
    {
        //
        // Go to sleep mode while waiting for data ready.
       //
        while(!g_vui8I2CDoneFlag)
        {
            //ROM_SysCtlSleep();
        }

        //
        // Clear the flag
        //
        g_vui8I2CDoneFlag = 0;

        //
        // Get floating point version of the Accel Data in m/s^2.
        //
        MPU9150DataAccelGetFloat(&g_sMPU9150Inst, pfAccel, pfAccel + 1,
                                 pfAccel + 2);


        }





}

Inside general.c file


#include "general.h"

#define  ResponseArraySize 50

int ResponseArrayPossision=0, n=0, z=0,delay = 250, short_delay = 4;
int GPRSConnectionStatus=0,UploadingActive=0;
char Response [ResponseArraySize], IntToCharBuff [3];

void UploadData (char data [100]) {
	int P=0;
	UploadingActive =1;

	//	 if (GPRSConnectionStatus != 1) {
	//		ConnectToServer ();

	//	}

		while (data [P] != '\0')
			{
			 UARTCharPut(UART5_BASE, data [P++]);
			}

		// implement some method to detect if connection is not there to re initiate connnection

}

int SendCommand (char StringBuff [], char RequiredResponse [], int NOFTries, int WaitTime )
{

	int i=0,j=0,k=0;

	for (j=0; j<=NOFTries; j++ ) {

		ClearReceivedBuffer ();
		i=0;
		while (StringBuff [i] != '\0')
		{
			 UARTCharPut(UART5_BASE, StringBuff [i++]);
			//UARTCharPut(UART0_BASE, StringBuff [i++]);

		}

		//Start Timer and Wait for WaitTime Milli Sesonds while checking for expected response
		for (k=0; k<=WaitTime; k++) {
			 SysCtlDelay(250 * ( SysCtlClockGet() / 3 / 1000));
			if (strstr (Response,RequiredResponse) != 0 ){
				return 1; }

		}
	}return 0;
}


/* 	void ActivateGPRS ()
 *	Existing GPRS connections are disconnected
 *	Tries all possible commands to attach to GPRS
 */



int ConnectToServer (){

	GPRSConnectionStatus=0;

	//Check for connectivity with GSM module

if (SendCommand ("AT\r\n", "OK", 3,short_delay) ==0){ //either off or in transparent mode

	 SysCtlDelay(( SysCtlClockGet() / 3)); // 1000mS delay required before +++
	 SysCtlDelay(( SysCtlClockGet() / 3));

	if (SendCommand ("+++", "OK", 2,5) ==0) { //Still NO response, module is OFF

		//GSMModule ("ON"); //must wait till connection is established checking for network can be done in it.

	}

}

	if(SendCommand ("AT+CREG?\r\n", "+CREG: 0,1", 3,short_delay)==1) {

		/* has to go in GSMModule ("ON")
			//Check for GSM connectivity
			if (CheckForGSMNetwork () == 0){
				return 0;
			} */

	}



	// Activate GPRS.
	if (SendCommand ("AT+CIPSHUT;+CIPMODE=1;+CIPSPRT=2;+CGATT=1;+CIPCCFG=5,2,10,1;+CIPMUX=0;+CSTT=\"PPWAP\";+CIICR;+CIFSR;+CIPSTART=\"TCP\",\"XX.XX.125.14\",\"29\";\r\n", "CONNECT", 3,100)!= 1)
	{
		return 0;
	}
	return (GPRSConnectionStatus=1);
}


void ClearArray (char array []){

	int j=0,numberOfChars;

	numberOfChars = strlen (IntToCharBuff);

	for (j=0; j<=numberOfChars; j++)
	{
		array [j]= '\0';
	}
}

void ClearReceivedBuffer (void)
{
	int i=0;
	int j;
	ResponseArrayPossision = 0;

	for (j=1; j<=ResponseArraySize; j++)
	{
		Response [i]= '\0';
		i++;
	}
	Response [0] = '\0';
}

void ClearIntToCharBuff (void)
{
	int i=0,j=0,numberOfChars;

	numberOfChars = strlen (IntToCharBuff);

	for (j=1; j<=numberOfChars; j++)
	{
		IntToCharBuff [i]= '\0';
		i++;
	}
	IntToCharBuff [0] = '\0';
}

void SystemInit (void){


	//SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
	PheripheralInit ();
	ConfigInterrupts ();
	//SendCommand ("AT+CLTS=1\r\n", "A", 3,short_delay);// require time to be requested from network at boot


}

void ConfigInterrupts (void) {

	 IntMasterEnable (); //enable processor interrupts
	 IntEnable(INT_UART5); //enable the UART interrupt
	 IntEnable(INT_UART0); //enable the UART interrupt
}

void PheripheralInit (void) {
	UART0Init();
	UART5Init();

}

void ConfigTimer0 (void) {

	//
	// Enable the peripherals used.
	//
	SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);

	//
	// Configure the two 32-bit periodic timers.
	//
	TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
	TimerLoadSet(TIMER0_BASE, TIMER_A,  SysCtlClockGet());

	//
	// Setup the interrupts for the timer timeouts.
	//
	IntEnable(INT_TIMER0A);
	TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
	TimerEnable(TIMER0_BASE, TIMER_A);
}



void UART0IntHandler (void)
{
	uint32_t ui32Status;
	ui32Status =  UARTIntStatus(UART0_BASE, true); //get interrupt status
	 UARTIntClear(UART0_BASE, ui32Status); //clear the asserted interrupts
	while( UARTCharsAvail(UART0_BASE)) //loop while there are chars
	{
		//Response [ResponseArrayPossision] = UARTCharGetNonBlocking(UART0_BASE);
		 UARTCharPutNonBlocking(UART5_BASE,  UARTCharGetNonBlocking(UART0_BASE) ); //echo character

		//ResponseArrayPossision++;
	}
}
void UART1IntHandler (void)
{
	/* if (UploadingActive){
		UploadingActive =0; // if you get a UART1 interrupt while uploading you are deffinitly disconnected
		GPRSConnectionStatus =0;

		if (ConnectToServer () != 1) { //ups! we couldnt connect. Lets try again.
			ConnectToServer (); // connct server function needs to be so good that once called it must connect.
								// conectserver () should even do a hard reset
		}
	} */


	uint32_t ui32Status;
	ui32Status =  UARTIntStatus(UART5_BASE, true); //get interrupt status
	 UARTIntClear(UART5_BASE, ui32Status); //clear the asserted interrupts
	while( UARTCharsAvail(UART5_BASE)) //loop while there are chars
	{
		Response [ResponseArrayPossision] =  UARTCharGetNonBlocking(UART5_BASE);
		 UARTCharPutNonBlocking(UART0_BASE, Response [ResponseArrayPossision] ); //Why doenst this work?
		ResponseArrayPossision++;
	}
}


//*****************************************************************************
//
// The interrupt handler for the first timer interrupt.
//
//
//*****************************************************************************
void
Timer0IntHandler(void)
{

	// must not be initialised untill the GPRS is activated!
	// you can have measures for reactivation of GPRS here
	// Upload can be a function that uploads data by itseld while transparent mode is on
    // If PDP DEACT is detected you can send +++ from here it self
	// wont work becaue when you are sending continuesly you are clearing the recieve buffer. there should be a new send func.
	// for that use upload data
	// Upload function can make use of the fact that UART data is returned. so when PDP DECT is sent, SIM starts returning.

     TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);

    // UPLOAD DUMMY DATA EVERY SECOND!

    UploadData ("A");
   /*

    if (strstr (Response,"PDP: DEACT") != 0 ){

    	// GPRS has been deactivated
    	//SendCommand ("+++\r\n", "OK", 3,delay);// no need to send it at this point.

    	GPRSConnectionStatus =0;
    	*/

    }

void UART0Init (void)
{
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
	GPIOPinConfigure(GPIO_PA0_U0RX);
	GPIOPinConfigure(GPIO_PA1_U0TX);
	GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
	UARTConfigSetExpClk(UART0_BASE,  SysCtlClockGet(), 115200,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
	UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT); //only enable RX and TX interrupts

}

void UART5Init (void)
{
	 SysCtlPeripheralEnable(SYSCTL_PERIPH_UART5);
	 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
	 GPIOPinConfigure(GPIO_PE4_U5RX);
	 GPIOPinConfigure(GPIO_PE5_U5TX);
	 GPIOPinTypeUART (GPIO_PORTE_BASE, GPIO_PIN_4 | GPIO_PIN_5);
	 UARTConfigSetExpClk(UART5_BASE,  SysCtlClockGet(), 115200,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
	 UARTIntEnable(UART5_BASE, UART_INT_RX | UART_INT_RT); //only enable RX and TX interrupts

}