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.

320VC5505 Uart Write error

Other Parts Discussed in Thread: TMS320VC5505

Hello Everyone, 

I am using the TMS320VC5505 EzDSP board and am having an issue using the uart port on the expansion header. I set up the project to use the CSL 2.5 library and have based the uart setup off of the polled uart example provided in the CSL folder. Currently i can successfully write over the uart port but when I attempt to read data the function fails and returns

#include <stdio.h>
#include "csl_uart.h"
#include "csl_uartAux.h"
#include "csl_general.h"
#include "usbstk5505_uart.h"

/* This file contains all functions required to initalize and communicate with the uart module
 * 
 */
CSL_Status init_uart(CSL_UartHandle *uartH)
{
	//uart initalization stuct
	CSL_UartSetup Params = {
		100000000,  		 	 /* input clock freq */
		115200,    		     	 /* baud rate */
		CSL_UART_WORD8,      	 /* word length */
		1,        				 /* stop bits */
		CSL_UART_DISABLE_PARITY, /* parity */
		CSL_UART_FIFO_DISABLE,
		/* Loop Back enable */
    	CSL_UART_NO_LOOPBACK,
		/* No auto flow control*/
		CSL_UART_NO_AFE ,
		/* No RTS */
		CSL_UART_NO_RTS ,
	};
	CSL_Status  status; //status 
	CSL_UartObj uartObj; //uart object
	
	//call uart init function
	status = UART_init(&uartObj,CSL_UART_INST_0,UART_POLLED);
	if(CSL_SOK != status)
    {
        printf("UART_init failed error code %d\n",status);
        return(status);
    }
    else
    {
		printf("UART_init Successful\n");
	}
	*uartH = (CSL_UartHandle)(&uartObj);
	
	//call setup function
	status = UART_setup(*uartH,&Params);
	if(CSL_SOK != status)
    {
        printf("UART_setup failed error code %d\n",status);
        return(status);
    }
    else
    {
		printf("UART_setup Successful\n");
	}
	return CSL_SOK;
}
/*****************************************************************************/
/*                                                                           */
/* FILENAME                                                                  */
/* 	 main.c                                                                  */
/*                                                                           */
/* DESCRIPTION                                                               */
/*   TMS320C5505 USB Stick. Application 1. Getting started.                  */
/*   Take microphone input and send to headphones.                           */
/*                                                                           */
/* REVISION                                                                  */
/*   Revision: 1.00	                                                         */
/*   Author  : Richard Sikora                                                */
/*---------------------------------------------------------------------------*/
/*                                                                           */
/* HISTORY                                                                   */
/*   Revision: 1.00                                                          */
/*   5th March 2010. Created by Richard Sikora from TMS320C5510 DSK code.    */
/*                                                                           */
/*****************************************************************************/
/*
 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 
 * 
 * 
 *  Redistribution and use in source and binary forms, with or without 
 *  modification, are permitted provided that the following conditions 
 *  are met:
 *
 *    Redistributions of source code must retain the above copyright 
 *    notice, this list of conditions and the following disclaimer.
 *
 *    Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the 
 *    documentation and/or other materials provided with the   
 *    distribution.
 *
 *    Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
 *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
 *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
 *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
*/

#include "stdio.h"
#include "usbstk5505.h"
#include "aic3204.h"
#include "PLL.h"
#include "stereo.h"
#include "usbstk5505_uart.h"

Int16 left_input;
Int16 right_input;
Int16 left_output;
Int16 right_output;
Int16 mono_input;


#define SAMPLES_PER_SECOND 48000

unsigned long int i = 0;
CSL_Status uartStatus;
CSL_UartHandle uartHandle;
char inputUartBuffer[30];
char outputUartBuffer[30];

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  main( )                                                                 *
 *                                                                          *
 * ------------------------------------------------------------------------ */
void main( void ) 
{
    /* Initialize BSL */
    USBSTK5505_init( );
	
	/* Initialize PLL */
	pll_frequency_setup(100);
	
    /* Initialise hardware interface and I2C for code */
    aic3204_hardware_init();
    
    /* Initialise the AIC3204 codec */
	aic3204_init(); 
	
	/* Setup sampling frequency and 30dB gain for microphone */
    set_sampling_frequency_and_gain(SAMPLES_PER_SECOND, 1);	
   
   // initilize UART 
	init_uart(&uartHandle);
	//main loop 
	while(1)
	{
		printf("please enter message\n");
		scanf("%s",inputUartBuffer);
		printf("sending %s",inputUartBuffer);
		uartStatus = UART_fputs(uartHandle,inputUartBuffer,0);
		if(CSL_SOK != uartStatus)
	    {
	        printf("UART_fputs failed error code %d\n",uartStatus);
	    }
	    
	    /* this is failing!!!, once it fails the write function stops working*/
	    uartStatus = UART_read(uartHandle,outputUartBuffer,2,0);
		if(CSL_SOK != uartStatus)
    	{   
        	printf("UART_read failed error code %d\n",uartStatus);
    	}
	}
   
 	
}

/* ------------------------------------------------------------------------ *
 *                                                                          *
 *  End of main.c                                                           *
 *                                                                          *
 * ------------------------------------------------------------------------ */
error code 13 and the entire uart controller stops working.  Has anyone else had this issue?  I've attached a copy of my main.c and uart init file.

Thanks 

John