Reading data from uart2

hi,
This is my code for reading data from UART2, while downloading the application on q2687, m2m is taking very long time.Later iam getting xmodem error.But while downloading from hyperterminal it is easily downloadable, Please comment whether the application is sufficient to read data from uart.

#include "adl_global.h"
#include "adl_fcm.h"

/***************************************************************************/
/*  Mandatory variables                                                    */
/*-------------------------------------------------------------------------*/
/*  wm_apmCustomStackSize                                                  */
/*-------------------------------------------------------------------------*/
/***************************************************************************/
const u16 wm_apmCustomStackSize = 1024*3;


bool tec_CtrlHandler(u8 event);
bool tec_DataHandler(u16 datlength,u8* data);
bool  ipr_rsphdl (adl_atResponse_t *Params);
s8 uart_handler;
ascii result;



/***************************************************************************/
/* Uart Callbacks                                                          */
/***************************************************************************/

bool tec_CtrlHandler(u8 event){
	switch(event){
	case ADL_FCM_EVENT_FLOW_OPENNED:
		adl_atCmdCreate("AT+IPR=9600;&w", ADL_AT_PORT_TYPE ( ADL_PORT_UART2, ADL_AT_RSP ),(adl_atRspHandler_t)ipr_rsphdl,NULL);
		TRACE((1,"UART2 HAS BEEN OPENNED"));
		adl_fcmSwitchV24State(uart_handler,ADL_FCM_V24_STATE_DATA);//to receive data
		break;
	case ADL_FCM_EVENT_FLOW_CLOSED:
		TRACE((1,"UART2 HAS BEEN CLOSED"));
		break;
	case ADL_FCM_EVENT_V24_DATA_MODE:
		TRACE((1,"ALREADY IN DATA MODE"));
		break;
	default:
		TRACE((2,"UNKNOWN EVENT OCCURED"));
		break;
	}
}


// this is to read data.

bool tec_DataHandler(u16 datlength,u8* data){
	TRACE((6,"IN TO DATA MODE,IF DATA IS ,COMING WILL READ NOW"));

	ascii NewText [ 20 ],txt[20];
		u16 i;
		result=*data;
	    for ( i = 0 ; i < datlength ; i++ )
	    {
	        if ( data [ i ] == '~' )
	        {
				adl_fcmUnsubscribe(uart_handler);
	        }
		else
			{
			txt[i]=data[i];
			wm_sprintf ( NewText, "%c", txt[i] );

		//	adl_atSendResponse(ADL_AT_UNS, NewText);//to send received data and display using uart1.
			//adl_fcmSendData ( FCM_Handler, NewText, datlength );
			}
		}
	return TRUE;
	}



bool ipr_rsphdl(adl_atResponse_t *Params)
{
	TRACE((5,"IN IPR RESPONSE HANDLER"));
         return;
}




// main function


adl_main(adl_InitType_e InitType)
{
	if(adl_fcmIsAvailable( ADL_FCM_FLOW_V24_UART2)==TRUE)
	{
		TRACE((1,"IN MAIN FUNCTION\n"));
		uart_handler=adl_fcmSubscribe ( ADL_FCM_FLOW_V24_UART2, (adl_fcmCtrlHdlr_f) tec_CtrlHandler, (adl_fcmDataHdlr_f) tec_DataHandler );
	}
	else
	{
		TRACE((2,"UART2 IS NOT AVAILABLE"));
    }
}

i am initializing uart2 using ,

at+wmfm=0,1,2

and i am changing baud rate of UART2 using

adl_atCmdCreate(), api to 9600.

Please comment as am unable to see the traces and my application does not starts even.

:smiley: ,i READ it. Yes I read IT.The Problem was my firmware, once i upgraded it,data is just flowing in with ease.

Thanks to all those who read my post and even to those who wished they could help but couldn’t. 8)

Can you explane me why you commented this in your code?
//adl_atSendResponse(ADL_AT_UNS, NewText);//to send received data and display using uart1.
//adl_fcmSendData ( UARTHandle, NewText, DataLen );

And does result = *data means that you put receiving data in result? If it does why you use “for”?

I’m a Newbie