Send and receive string by a sensor rs232

Hello, nice to meet you all,
I have a problem, and searched the forum but did not and found the solution.

I have an extended fxt009, and I need to send a string and get answers from a sensor that communicates via RS232.
I have a code I found on the forum, and also adl_fcmSendData UART communication.

by hyperterminal, sending the string “TEST \ n” and returns me “TEST”
example

“TEST”
<“TEST”

Do not e able to work with the code, I’ll be doing wrong? I need some guidance or information.
attached the code I’m using.

#include "adl_global.h"
#include "generated.h"

static s8 FCM;
static s8 FCMV24;
static s8 fcmData;
static s8 Ipr, Wmfm;
adl_fcmFlow_e flow = ADL_PORT_UART2;

bool HandleWmfmUart2(adl_atResponse_t *response);



void SendData(u8 Id)
{

   TRACE((1,"CTM\n"));
s8 data = "TEST\n";

fcmData = adl_fcmSendData(FCM, data, 5);
TRACE((1,fcmData));

}

bool CtrlHandler(adl_fcmEvent_e event)
{
switch( event )
{
case ADL_FCM_EVENT_FLOW_OPENNED :
TRACE(( 1, "ADL_FCM_EVENT_FLOW_OPENNED\n"));
FCMV24 = adl_fcmSwitchV24State(FCM, ADL_FCM_V24_STATE_DATA);
TRACE(( 1, "adl_fcmSwitchV24State = %d", FCMV24));
break;

case ADL_FCM_EVENT_V24_DATA_MODE :
TRACE(( 1, "ADL_FCM_EVENT_V24_DATA_MODE\n"));
adl_tmrSubscribe(TRUE, 100, ADL_TMR_TYPE_100MS, (adl_tmrHandler_t)SendData);
break;

case ADL_FCM_EVENT_V24_AT_MODE :
case ADL_FCM_EVENT_V24_AT_MODE_EXT:
TRACE(( 1, "ADL_FCM_EVENT_V24_AT_MODE\n"));

FCMV24 = adl_fcmSwitchV24State(FCM, ADL_FCM_V24_STATE_AT);

break;

case ADL_FCM_EVENT_FLOW_CLOSED:
TRACE(( 1, "ADL_FCM_EVENT_FLOW_CLOSED\n"));
adl_fcmUnsubscribe(FCM);
break;

case ADL_FCM_EVENT_RESUME :
TRACE(( 1, "ADL_FCM_EVENT_RESUME\n"));
break;

case ADL_FCM_EVENT_MEM_RELEASE :
TRACE(( 1, "ADL_FCM_EVENT_MEM_RELEASE\n"));

break;
}
}

bool DataHandler(u16 DataLen, u8 * Data)
{
TRACE(( 1, "DataHandler\n"));
return TRUE;
}

bool HandleWmfmUart2(adl_atResponse_t * response)
{
TRACE (( 1, "HandleWmfmUart2Enable\n" ));
FCM = adl_fcmSubscribe(flow, CtrlHandler, DataHandler);
TRACE(( 1, "adl_fcmSubscribe= %d", FCM));
return FALSE;
}

bool HandleIPR(adl_atResponse_t * response)
{
TRACE(( 1, "HandleIPR\n"));
return FALSE;
}

void main_task(void) {
   // TODO Insert your task initialization code here
   TRACE (( 1, "Embedded Application : FCM\n" ));

   Wmfm = adl_atCmdCreate("AT+WMFM=0,1,2", FALSE, HandleWmfmUart2, "*", NULL);
   TRACE(( 1, "adl_atCmdCreate(AT+WMFM)= %d", Wmfm));

   Ipr = adl_atCmdCreate("AT+IPR=19200", ADL_AT_PORT_TYPE(flow, FALSE), HandleIPR, "*", NULL);
   TRACE(( 1, "adl_atCmdCreate(AT+IPR)= %d", Ipr));
}

ADl level traces.

I hope your help and thanks for reading

best regards

Hi,

What is the error you are getting with the code?

What all events received at your end.

Does it go in data mode?
Is data handler being called?

Thanks.

Hello,
I have the modem fxt009, the idea is to send a string and get back the answer to this, but I can not send or receive the string.

mode is ADL_FMC_EVENT_MEM_RELEASE

By hyperterminal, I send the string to the device (weather), RS232 and returns me what is required.

Not sure if the procedure is right or I am failing at something, I’m kind of new at this.

best regards

Hi gmbeas.

You should got answer (incoming FCM DATA) pointed by u8 * Data within your function

bool DataHandler(u16 DataLen, u8 * Data)
{
TRACE(( 1, "DataHandler\n"));
/* put TRACE for variable u8 *Data here */
return TRUE;
}

Try it.

https://forum.sierrawireless.com/t/sample-code-for-uart/5373/1