I have written the following code to access the UART2.It should give an at response “OK” when I am fetching the “AT” command.But it’s not working.Please help me to solve the problem with proper code and suggestion.
bool Res_AT_Handler(void)
{
return TRUE;
}
//////////////////////////////////////
void My_TimerHandler ( u8 ID )
{
TRACE (( 1, "Embedded : Hello DEBMALYA" ));
adl_atSendResponse ( ADL_AT_UNS, "\r\nHello DEBMALYA\r\n" );
adl_atCmdCreate( "AT", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), Res_AT_Handler, "*", NULL );
}
////////////////////////////////////////////
void adl_main ( adl_InitType_e InitType )
{
TRACE (( 1, "Embedded Application : Main" ));
//adl_portSubscribe(ADL_PORT_UART2);
// /////////////////////////////////////////
UART2_Enable();
adl_tmrSubscribe ( TRUE, 10, ADL_TMR_TYPE_100MS, My_TimerHandler );
}
void fcmCtrlH ( u8 event )
{
switch ( event )
{
case ADL_FCM_RET_ERROR_GSM_GPRS_ALREADY_OPENNED :
TRACE (( 1, "Flow GSM already Opened"));
break;
}
}
void fcmDataH ( u16 DataLen, u8 * Data )
{
u8 result;
adl_atSendResponse(ADL_AT_UNS, "\r\n<- Receive FCM Data Blocks \r\n");
DUMP ( 1, Data, DataLen );
}
bool Res_WMFM1_Handler ( void )
{
return TRUE;
}
bool Res_IPR_Handler ( void )
{
return TRUE;
}
void UART2_Enable ( void )
{
adl_atCmdCreate( "AT+WMFM=0,1,2", FALSE, Res_WMFM1_Handler, "*", NULL );
adl_atCmdCreate( "AT+IPR=4800", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), Res_IPR_Handler, "*", NULL );
adl_fcmSubscribe( ADL_FCM_FLOW_V24_UART2, fcmCtrlH, fcmDataH );
}