Control is not going to Data handler in FCM UART1


#1

Hi,everybody…
I am trying to communicate with PC from my q2686.I am using FCM_UART1 . In traces i am able to see, its going to control handler, but when i type something from PC keyboard.Its not going to Data handler.
Please guide me where i am going wrong here.I have attached my code.

Thanks and best regards
Hegde

bool CtrlHdlr(adl_fcmEvent_e Event)
{
	 switch(Event){
	       case ADL_FCM_EVENT_FLOW_OPENNED:
	    	   TRACE( (1,"ADL_FCM_EVENT_FLOW_OPENNED") );
	           adl_atSendResponse ( ADL_AT_UNS, "\r\nUART1 HAS BEEN OPENNED");
	           adl_fcmSwitchV24State(FCM_Handle,ADL_FCM_V24_STATE_DATA);//to receive data
	           break;
	       case ADL_FCM_EVENT_FLOW_CLOSED:
	    	   TRACE( (1,"ADL_FCM_EVENT_FLOW_CLOSED") );
	           adl_atSendResponse ( ADL_AT_UNS, "\r\nUART1 HAS BEEN CLOSED");
	           break;
	       case ADL_FCM_EVENT_V24_DATA_MODE:
	    	   TRACE( (1,"ADL_FCM_EVENT_V24_DATA_MODE") );
	           adl_atSendResponse ( ADL_AT_UNS, "\r\nALREADY IN DATA MODE");
	           break;
	       default:
	    	   TRACE( (1,"UNKNOWN EVENT OCCURED") );
	           adl_atSendResponse ( ADL_AT_UNS, "\r\nUNKNOWN EVENT OCCURED");
	           break;
	       }
	       return TRUE;
	 	return TRUE;
}


bool DataHdlr(u16 DataLen, u8 *Data)
{
	TRACE( (1,"DataLen %d",DataLen) );
	adl_atSendResponse(ADL_AT_RSP,"IN TO DATA MODE:");
	u16 i;
	           for ( i = 0 ; i < DataLen ; i++ )
	             {
	        	  Buffer[i]=Data[i];
	              wm_sprintf ( NewText, "%c", Buffer[i] );
	              adl_atSendResponse(ADL_AT_UNS, NewText);//to send received data and display using uart1.
	             }
	       return TRUE;

}


void fcm_uart(void)
{
	if( adl_fcmIsAvailable (ADL_FCM_FLOW_V24_MASTER ) )
	{
		TRACE((1,"Port is available"));
		adl_atSendResponse(ADL_AT_UNS,"\r\nPort is available");
		FCM_Handle = adl_fcmSubscribe(ADL_FCM_FLOW_V24_MASTER, CtrlHdlr, DataHdlr);
	}
}

#2

The first thing to do is check the return values to all your function calls. That will give you alot of information about what is working or not.


#3

hi…
thank you for your reply…
In trace window, i can see
adl_fcmIsAvailable (ADL_FCM_FLOW_V24_MASTER )—Port is available–
when i subscribe fcm it goes to control handler
where m checking events
It will show ADL_FCM_EVENT_FLOW_OPENNED:
after that m switching mode ADL_FCM_EVENT_V24_DATA_MODE
this much i can see…that means i hav successfully opened my UART1 FCM in data mode. But still it accepts at command…:frowning:
when i type at from key board it ll rply OK
but it is not entering DATA Handler function. What are all the other factors affecting in this case.? I am new to OpenAT please guide me.

Thanks and best regards
Hegde


#4

Are you using TMT?

IF so, it will continue to accept AT commands in the AT window - you have to type in the DATA window for stuff to go to the FCM Data Handler…


#5

Hi…awneil
Thank you for your reply…
I was debugging from last 2 days.
These things i observed:
When i use debugging mode in M2M and shell to see the adl_send response messages
It will come to-" ALREADY IN DATA MODE" It indicates adl_switch mode activated to DATA mode

but if i use my other serial port tools, ( m using dock light settings i made it exactly like m2m 115200 8N1 and H/W flow control)
message comes till “ADL_FCM_EVENT_FLOW_OPENNED”
after this i am executing adl_Switch_mode. it should display ALREADY IN DATA MODE but it is not displaying

I doubt here something going wrong. my module getting hanging ?? I dont know its not taking at command also.
please see my code

/*
 * Main_FCM.c
 *
 *  Created on: Oct 7, 2010
 *      Author: Hegde
 */

/****Mandatory *******************/
#include"adl_global.h"

const u16 wm_apmCustomStackSize = 1024*3;

/****Variables *******************/
s8 FCM_UART1_Handle;
s8 ADL_CHECK;
/*********************************FCM HANDLERS AND SUBSCRIPTION***************************************************************/
bool CtrlHdlr(adl_fcmEvent_e Event)
{
	 switch(Event)
	 {
	       case ADL_FCM_EVENT_FLOW_OPENNED:
	    	   TRACE( (1,"ADL_FCM_EVENT_FLOW_OPENNED") );
	           adl_atSendResponse ( ADL_AT_UNS, "\r\nUART1 OPENED\r\n");
	           adl_fcmSwitchV24State(FCM_UART1_Handle,ADL_FCM_V24_STATE_DATA);  //to receive data in DATA MODE
	           adl_atSendResponse ( ADL_AT_UNS, "\r\nSWITCH STATE EXECUTED\r\n");
	           break;
	       case ADL_FCM_EVENT_FLOW_CLOSED:
	    	   TRACE( (1,"ADL_FCM_EVENT_FLOW_CLOSED") );
	           adl_atSendResponse ( ADL_AT_UNS, "\r\nUART1 HAS BEEN CLOSED");
	           break;

	       case ADL_FCM_EVENT_V24_DATA_MODE:
	    	   TRACE( (1,"ADL_FCM_EVENT_V24_DATA_MODE") );
	           adl_atSendResponse ( ADL_AT_UNS, "\r\nALREADY IN DATA MODE");
	           break;
	       case ADL_FCM_EVENT_V24_AT_MODE:
	       	   TRACE( (1,"ADL_FCM_EVENT_V24_AT_MODE") );
	       	   adl_atSendResponse ( ADL_AT_UNS, "\r\nALREADY IN AT MODE");
	       	   break;

	       default:
	    	   TRACE( (1,"UNKNOWN EVENT OCCURED") );
	           adl_atSendResponse ( ADL_AT_UNS, "\r\nUNKNOWN EVENT OCCURED");
	          // adl_fcmUnsubscribe(FCM_UART1_Handle);
	           break;

	       }
	       return TRUE;

}
//Handle incoming DATA
bool DataHdlr(u16 DataLen, u8 *Data)
{
	TRACE( (1,"DataLen %d",DataLen) );
	return TRUE;

}
//Subscribe Function
void fcm_uart_subscribe( void )
{
	if( adl_fcmIsAvailable (ADL_FCM_FLOW_V24_MASTER ) == TRUE )
		{
			TRACE((1,"Port is available"));
			adl_atSendResponse(ADL_AT_UNS,"\r\nPort is available");
			FCM_UART1_Handle = adl_fcmSubscribe(ADL_FCM_FLOW_V24_MASTER, CtrlHdlr, DataHdlr);
			TRACE((1,"%d",FCM_UART1_Handle));
		}
}
/*********************************SIM HANDLER AND SUBSCRIPTION******************************************************/
void Sim_Handler( u8 Event)
 {

    switch(Event)
    {
    case ADL_SIM_EVENT_PIN_OK:
            TRACE((1,"SIM event Pin Ok"));
            break;
    case ADL_SIM_EVENT_REMOVED:
            adl_atSendResponse(ADL_AT_RSP,"\r\nPlease Insert Sim_card\r\n");
			TRACE((1,"ADL_SIM_EVENT_REMOVED"));
            break;
    case ADL_SIM_EVENT_INSERTED:
            TRACE((1,"ADL_SIM_EVENT_INSERTED"));
            adl_atCmdCreate ( "AT+CMGD=1,4",FALSE, NULL, NULL);
			break;
    case ADL_SIM_EVENT_FULL_INIT:
            adl_atSendResponse(ADL_AT_UNS,"\r\nSim_Card Is Registered to Public Network");

            fcm_uart_subscribe();															//FCM_UART1 Subscription
            break;

	}
}
/*****Subscribe SIM *****************/
void sim_subscribe(void)
{
	adl_simSubscribe(Sim_Handler, "4511");
}
/*************************************Application Entry point***********************************************************/
void adl_main ( adl_InitType_e  InitType )
{


	switch(InitType)
	{
				case ADL_INIT_POWER_ON:
					adl_atSendResponse(ADL_AT_RSP,"\r\nEmbedded OS Power_On :[OK]\r\n");
					break;
				case ADL_INIT_REBOOT_FROM_EXCEPTION:
					adl_atSendResponse(ADL_AT_RSP,"\r\nReboot From Exception\r\n");
					break;
				case ADL_INIT_DOWNLOAD_SUCCESS:
					adl_atSendResponse(ADL_AT_RSP,"\r\nDownload Initialized\r\n");
					break;
				case ADL_INIT_DOWNLOAD_ERROR:
					adl_atSendResponse(ADL_AT_RSP,"\r\nDownload Error\r\n");
					break;
				case ADL_INIT_RTC:
					adl_atSendResponse(ADL_AT_RSP,"\r\nPower On due to RTC\r\n");
					break;
	}

	TRACE (( 1, "Embedded : Appli Init" ));
	adl_atSendResponse(ADL_AT_UNS,"\r\nMaking It Wireless\r\n");
	sim_subscribe();
}
/*************************************END OF adl_main****************************************/

How to get rid of it??
Please guide me…

Best regards
Hegde


#6

Are you using a serial link(UART2) =>USB port for the trace outputs so that the uart1 is free for your data input?


#7

Hi…Ben FT.
I am not using UART2. My hardware has only UART1.for both traces and data am using 1 only.
Using this one UART port i need to do my assignment. I am sure abt flow opening with
adl_fcmSubscribe(ADL_FCM_FLOW_V24_MASTER, CtrlHdlr, DataHdlr);
and control goes to CtrlHdlr too.
after this i need to switch_state to data mode. I am doing that.Here something going wrong i think.
if i put trace in DataHdler also…Trace is not showing if i give any input… :cry: :cry:
I am working on this from last 2days.No progress. …
Please check it out my code any thing wrong?? i hav attached it in previous post.


#8

Hummm … there could be something fishy going on here.

Hyperterminal and R7.44 are doing odd things for me. I too can’t get back to AT mode. (I’ve tried XON, NONE and Hardware modes)
If I use PuTTY as my terminal it all works OK.

Hyperterminal works just fine on my R7.40 firmware.

Is everyone else happy with their R7.44 serial port usage (using Hyperterminal or are there others, gnhegde mentioned Docklight)?

By the way gnhegde, have you tried NONE flow control?


#9

This hasn’t gone away for me. I now need to talk to the FSU20/Xtend with R7.44 without Hardware flow control, with R7.40 it was Hardware flow control. And I can only get the “+++” escape sequence to work from PuTTY, not Hyperterminal now.
My UART1 runs at 2400 if that makes any difference. Is everyone else’s UART1 working OK?


#10

https://forum.sierrawireless.com/t/fcm-problem-in-getting-data-from-sensor/3176/23


#11

I do set AT+IFC=0,0; there is something different with the firmware versions though. I’ll let you know what I find. There is something mentioned in the release note on escape sequences, but I’m not sure if its down to that.


#12

How about the loopback, then?


#13

I wonder if this has anything to do with it, and when it is due to be fixed?
https://forum.sierrawireless.com/t/upgrade-to-firmware-7-4a-and-uart2/4136/2

I will try loopback when I get some time with the soldering iron, but I can’t see all of the units in the field being rewired!