Could not change uart1 to data mode


#1

hi,
i am trying to do coding for UART1(Q24EXTENDED)…i am suceeded in subcribing it after that i cant change the mode to data…adl_fcmSwitchV24State(FCM_UART1_handle,ADL_FCM_V24_STATE_DATA);i think this function is not working.But this code is working fine if i use this code for UART2 i am able to change it to data mode.
pl somebody help me


#2

what do you think is not working? do you get an error code?


#3

Actually im not gettin any error code…But UART1 is not changing its mode(from AT to DATA)after the flow is opened.This same code works fine if i change the UART…That is UART2 instead of UART1…With UART2 i can change the mode to DATA once the flow is opened.Here is my code…

#include “adl_global.h”

u32 wm_apmCustomStack [ 256 ];
const u16 wm_apmCustomStackSize = sizeof ( wm_apmCustomStack );
s8 V24handle;

bool FcmCntrlHandler (adl_fcmEvent_e event)
{
adl_atSendResponse ( ADL_AT_UNS,"\r\n CONTRL HANDLER\r\n");
switch (event)
{
case ADL_FCM_EVENT_FLOW_OPENNED:
adl_fcmSwitchV24State(V24handle,ADL_FCM_V24_STATE_DATA);
adl_atSendResponse (ADL_AT_RSP, “\r\nCtrl is in case 1:Flow Opened\r\n” );

  break;

  case ADL_FCM_EVENT_FLOW_CLOSED:
      //MaySend=FALSE; 
  break;

  case ADL_FCM_EVENT_V24_DATA_MODE:
     // MaySend=TRUE;
	  adl_atSendResponse (ADL_AT_RSP,  "\r\nCtrl is in Case 3:DATA MODE\r\n" );
      //adl_tmrSubscribe ( TRUE, 900, ADL_TMR_TYPE_100MS, ReadEasy_TimerHandler );
  break;

  case ADL_FCM_EVENT_V24_DATA_MODE_EXT:
	   adl_atSendResponse (ADL_AT_RSP,  "\r\nCtrl is in Case4:DATA MODE EXT\r\n" );
	   //MaySend=TRUE; 
  break;

  case ADL_FCM_EVENT_V24_AT_MODE:
	   adl_atSendResponse (ADL_AT_RSP,  "\r\nCtrl is in Case4:AT MODE\r\n" );
	   //MaySend=FALSE; 
  break;

  case ADL_FCM_EVENT_RESUME:
  break;

  case ADL_FCM_EVENT_MEM_RELEASE:
  break;

}
return TRUE;

}

bool FcmDataHandler (u16 DataLen, u8 * Data)
{
adl_atSendResponse ( ADL_AT_UNS,"\r\n DATA HANDLER\r\n");
return TRUE;
}

void timer_handler(u8 id)
{
adl_atSendResponse ( ADL_AT_UNS,"\r\n TIMER HANDLER\r\n");
V24handle=adl_fcmSubscribe(ADL_PORT_UART1, FcmCntrlHandler, FcmDataHandler);
}

void adl_main ( adl_InitType_e InitType )
{
TRACE (( 1, “Embedded Application : Main” ));
adl_atSendResponse ( ADL_AT_UNS,"\r\n MAIN\r\n");

adl_tmrSubscribe(FALSE,10*10,ADL_TMR_TYPE_100MS,timer_handler);

}


#4

I think the problem might be that you should not use “adl_atSendResponse” in data mode… Maybe that is switching you back to AT mode. There are special fcm_ functions to send data through a flow… That also might explain that it is working with UART2 since the "adl_atSendResponse"s are still sent through UART1 and not to UART2. That’s why this is not impacted…

Hopefully, that is it… Otherwise, I have no idea…


#5

thanks a lot jan