AT+CREG=1 not work in adl_atCmdCreate();

#1

Source:

s16 Creg_Handler(adl_atResponse_t *paras)
{
adl_atSendResponse(ADL_AT_UNS, “\r\nThis is the feedback from AT+CREG=1\r\n”);
adl_atSendResponse(ADL_AT_UNS, paras->StrData);
}

void adl_main(adl_InitType_e InitType)
{
adl_atCmdCreate(“AT+CREG=1”, FALSE, (adl_atRspHandler_t)Creg_Handler, “*”, NULL);
}

When run this program the feedback is:

This is the feedback from AT+CREG=1

OK

Then I checked the result by manually input AT+CREG?, it still work as +CREG:0,1, NOT work as +CREG: 1,1.

So I have to manually input AT+CREG=1 to let module run on +CREG: 1,1.

Anyone can tell me what’s happened?

Thanks

0 Likes

#2

and I change to AT+CREG? and run this program.

The result is:

This is the feedback from AT+CREG?

+CREG: 2,1,“0113”,“2078”

This is the feedback from AT+CREG?

OK

But when I manually input at+creg? It displays as:

+CREG: 0,1

OK

0 Likes

#3

Here is the definition I copied from adl_at.h

/* --------------------------------- /
/
Body for response message type : /
/
--------------------------------- */
typedef struct
{
#ifndef REMOTETASKS
adl_strID_e RspID;
adl_atPort_e Dest;
#else
u8 RspID;
u8 Dest;
#endif
u16 StrLength;
ascii StrData[1];
} adl_atResponse_t;

So the question is: Why StrData is defined as StrData[1], not defined as ascii *StrData or ascii *StrData[100], and so on.

0 Likes