Sending hex value 0xAA through serial port


     im making a applicaton to interface with a device by sending hex values
const u8 Hx =  { 0xAA, 0x05, 0x01, 0x00, 0x00, 0x00 };

to the device . but it is a problem in sending “0XAA” through serial communication. so can u help me.


What is the problem? How are you trying to send the data, and how is it failing?

hello tomridl,

   trying to send below hex data's for communicating with the a device and it will respond only the following hex values are received through uart at a stretch.
const u8 Hx[6] =  { 0xAA, 0x05, 0x01, 0x00, 0x00, 0x00 };

But for sending the data 0xAA which is of two u8 bytes which is not possible to send at a stretch through serial communication. so can u help me?

Firstly, 0xAA is a single u8 byte (in binary it would be 1010 1010, i.e. 8 bits which is one u8). 0xAA is just a number (170), and is no different from any other number.

Are you successfully subscribing to the FCM using the adl_fcmSubscribe function before trying to send the data?

Is the receiver set to the correct baud rate to receive the packet?

Are you using « 7 bits » mode on a v24 serial link?

hello tomridl,

#include "adl_global.h"
    #include "adl_sms.h"
    #include "adl_msg.h"
    #include "wm_stdio.h"
    #include "adl_fcm.h"
    #include "wip.h"
    #include "adl_at.h"
    #include "adl_CmdHandler.h"
    #define SMS_MAX_LENGTH   160

/***********************************STACK INITILISATION*********************************/
	#if __OAT_API_VERSION__ >= 400
	const u16 wm_apmCustomStackSize = 4096;
	u32 wm_apmCustomStack[1024];
	const u16 wm_apmCustomStackSize = sizeof(wm_apmCustomStack);

       const u8 Hx[] =  { 0xAA, 0x05, 0x01, 0x00, 0x00, 0x00 };
       const s32 Hx_LEN = sizeof(Hx)/sizeof(Hx[0]);
        bool uart_open_Handler( adl_atResponse_t *paras );
       void faredata(u8 ID);
       void Query_Fare1(u8 ID);

/************************************EXTERNAL VARIABLES*********************************/
    extern s8 fcm_handle;
    extern char time_buff[50];
/************************************GLOBAL VARIABLES***********************************/
    s8 sms;
    s8 smsHandler;
    s8 t;
    s8 s;
    ascii Buffer[SMS_MAX_LENGTH];
    ascii Buffer1[300];
    u16 strlength;
    u32 smsSend;
    void tmrHandle(u8 ID);
    adl_fcmDataHdlr_f data1_handler;
    adl_fcmCtrlHdlr_f ctrl1_handler;
    s8 uart_handler;
    ascii result[160];
    ascii Rx_Str[50];
    u16 RxCnt_U1=0;
    u16 RxCnt;
    u16 Rx_Str_Len=6;
    ascii * Rx_Str_U1;

 ARGUMENTS    : ascii *
 RETURN TYPE  : Boolean type
 DESCRIPTION  : smsHandle is called each time when an SMS is received from the network

	//Sms handle
    bool smsHandle(ascii *Smstel,ascii *SmsTimeLength,ascii *SmsText)

    	//Buffer value initialised to store the received message text
    	ascii Buf[300];

    	//Response to send the originating telephone number of the received message
        adl_atSendResponse(ADL_AT_UART1, Smstel);

        //Copying the originating telephone number of the SMS to the buffer(Buffer1)

        //Response to create a new line
    	adl_atSendResponse(ADL_AT_UART1, "\r\n");

        //Response to display the text SMS Time:
    	adl_atSendResponse(ADL_AT_UART1, "\r\nSMS Time: ");

        //Response to send the SMS Time Stamp in text mode
    	adl_atSendResponse(ADL_AT_UART1, SmsTimeLength);

    	//Response to create a new line
    	adl_atSendResponse(ADL_AT_UART1, "\r\n");

    	//Response to display the text SMS TEXT: to the port provided
    	adl_atSendResponse(ADL_AT_UART1, "\r\nSMS Text: ");

    	//Response to send the received text message in SmsText to the port provided
    	adl_atSendResponse(ADL_AT_UART1, SmsText);

    	//Copying the recieved message in SmsText to the buffer(Buffer)

    	//Response to send the text
    	adl_atSendResponse(ADL_AT_UART1, "\r\n rec buffer");

    	//Response to display the text Buffer
    	adl_atSendResponse(ADL_AT_UART1, "Buffer");

        adl_atSendResponse(ADL_AT_UART1, "\r\nSMS Text: ");

    	//Response to send the received text message in SmsText to the port provided
    	adl_atSendResponse(ADL_AT_UART1, Buffer);

	    return FALSE;


FUNCTION_NAME: smsCtrlHandle
ARGUMENTS    : u8,u16
DESCRIPTION  : smsCtrlHandle is notified each time by following events when sending
			   an SMS to the network
    void smsCtrlHandle(u8 Event,u16 Nb)


        //Event when the messge was sent successfully
         TRACE((1,"SMS SENDING OK"));
         adl_atSendResponse(ADL_PORT_UART1,"SMS sent successfully");

        /*Event occurs when SMS was sent successfully, Nb parameter contains the sent
		Message Reference value*/

        //Event when an error occured during the sending of SMS


    /************************************EVENT BASED FUNCTIONS******************************/
         FUNCTION_NAME: adl_atRspfun
         ARGUMENTS    : adl_atResponse_t *
         RETURN TYPE  : Boolean type
         DESCRIPTION  : The function adl_atRspfun describes which is used to respond to
        				AT_commands which is transfered to UART2.
        	bool ipr_rsphdl (adl_atResponse_t * Params)

        	  return TRUE;

         FUNCTION_NAME: ctr_hdl
         ARGUMENTS    : adl_fcmEvent_e
         RETURN TYPE  : Boolean type
         DESCRIPTION  : The function ctr_hdl describes which will be invoked when UART2's flow
        			    control manager receives control events then it will be execute
        			    the instructions according to the control events.

        bool tec_CtrlHandler(u8 event)


        	         case ADL_FCM_EVENT_FLOW_OPENNED:

        	                 adl_atCmdCreate("AT+IPR=115200;&w", ADL_AT_PORT_TYPE ( ADL_PORT_UART1,  ADL_AT_RSP ),(adl_atRspHandler_t)ipr_rsphdl,NULL);
                                adl_fcmSwitchV24State(uart_handler,ADL_FCM_V24_STATE_DATA);//to receive  data


        	         case ADL_FCM_EVENT_FLOW_CLOSED:

        	               adl_atSendResponse(1,"UART1 HAS BEEN CLOSED");


        	         case ADL_FCM_EVENT_V24_DATA_MODE:

        	              adl_atSendResponse(1,"ALREADY IN DATA MODE");
        	           	        adl_atSendResponse(1,"about to tune uart 1 \n");
        	           	        adl_atSendResponse(1,"UART1 HAS BEEN OPENNED");


        	           	        //Event occurs when the data block memory buffer will be released,
        	           	     case ADL_FCM_EVENT_MEM_RELEASE:

        	           	        //FOR TESTING.....

        	           	        //Function to release all credits at any time



        	           	        adl_atSendResponse(2,"UNKNOWN EVENT OCCURED");


        	           	     return TRUE;


        	   void Query_FARE(u8 ID)

        	   wm_memset(Rx_Str ,'\0',Rx_Str_Len);
        	   RxCnt =0;
        	   adl_tmrSubscribe ( FALSE,300 , ADL_TMR_TYPE_TICK , faredata);

        	   void faredata(u8 ID)

        	     ascii s[50];


        	   //UART data handler

        	   bool tec_DataHandler(u16 dataLen, u8 * data)


        	   RxCnt_U1 = RxCnt_U1 + dataLen;
        	   return TRUE;


        void Query_Fare(u8 ID)


       void faredata(u8 ID)


              /*ascii s[50];



   FUNCTION_NAME: adl_main
   ARGUMENTS    : adl_InitType_e
   RETURN TYPE  : void
   DESCRIPTION  : The function adl_main describes which is used to configure the SMS
    			  subscribe and UART2.Before configure the UART2,it will check the
    			  availability of UART2 PORT and if it is available ,it will open the UART2
    			  and defines control handler and data handler to response corresponding
        void adl_main(adl_InitType_e InitType)

           TRACE (( 1, "Embedded Application : Main" ));

           int r;

    	   //Declare variable which will be used to hold the boolean type values.
           //FOR TESTING...........
           TRACE((1,"MAIN FUNCTION"));

           //Invoke the adl_smsSubscribe API function to Open the smsSubscribe
           //with text mode and defines a address of control handler to response
           //the events.

           r = wip_netInitOpts(
        	          /* WIP traces on UART1 */



          ctrl1_handler = tec_CtrlHandler;
          data1_handler = tec_DataHandler;
          uart_handler = adl_fcmSubscribe ( ADL_PORT_UART1 ,ctrl1_handler,data1_handler );


The above is my code on sending the hex values i should get response through SMS but im getting only empty SMS. Baud rates are same for both the devices “115200” and im using 8 bit data transfer.

Note that these are unprintable characters, and thus will not show up in an SMS.


 thanks for the reply, but on seeing the data response from hyperterminal i m not getting proper data only a single junk data.

In the code you posted, you had 2 functions called Query_Fare and 2 called faredata. Which are the correct ones?

Try to explain exactly what you are trying to achieve, because I am still not quite sure what you want to do. ( )


  i will explain u the whole thing. im trying to interface my Q2686 module with a camera for receving snapshot using OV528 Protocol and transferring the data through FTP to server. For making connection with camera i need to send command through synchronous communication for making connection with it

"AA 0D 00 00 00 00" 

In response it will send “AA 0E 0D 00 00 00”

so after making connection i need to send command for taking snapshot “AA 04 01 00 00 00” and data image will be packet data of 1024 bytes of hex data. and so on till the last byte.

So im having trouble in making connection with the camera for receiving the response data. so can u help me?

Have you carefully studied the whole of the description of FCM in the ADL User Guide :question:

There is an Application Note about FCM in the downloads area.

Have you spoken to your Distributor or FAE for assistance :question:

Have you looked at this example: viewforum.php?f=111 :question:

Haev you looked at the examples included with the Developer Studio :question:

Ya i have gone through the description of FCM i did not get can u please specify

ya i have gone through it but sorry i did not found any example related to this.


On sending the total hex string "0xAA,0x0D,0x00,0x00,0x00,0x00"  i can able to see only  "ª" on hyperterminal which is 0xAA so i think the remaining values are not properly send. 

Im using

const u8 QUERY_FARE[6] =  {0xAA,0x0D,0x00,0x00,0x00,0x00};


can u help me why the remaining hex values are not send.

As has already been pointed out to you, these are non-printing codes - so you should not expect to see anything meaningful on a text-based terminal like Hyperterminal :exclamation:

First you need to determine whether they are actually not being sent, or if it’s just that you are not seeing them being received - eg, due to using an inappropriate tool (Hyperterminal)…

Try using a program called Docklight (, and put it into HEX mode. You will see exactly what is being transmitted.

thanks for ur replies

Have a look at the Open UART Service in the Device Services of the ADL User Guide. You might be able to use this. You could also control the required handshaking lines by using them as a GPIO and using the GPIO Service.

If you’re struggling to understand FCM, then you’ll have no chance with Open UART :exclamation:

Please explain exactly what you mean by this “handshake”

Be sure to explain clearly what you actually need to achieve - not (just) your idea of a method to aqchieve it