HTTP Session flow for M66

I am creating a new project where I am willing to use M66 for the GSM/GPRS part. The HTTP Application Note document is not quite clear and I have few questions. The major 2 questions are

  1. Do we need to have the carriage return (\r) character at the end of the URL?
  2. If we need to include the \r character at the end of the URL, then do we count that while calculating size of URL?

Right now I have \r appended at the end of the URL like below

char url[ ] = "**************************\r";
sprintf(cmd, "AT+QHTTPURL=%d\r", sizeof(url)-1);

I have also tried with the following

char url[ ] = "***********************";
sprintf(cmd, "AT+QHTTPURL=%d\r", sizeof(url));

The result is same…

Here is the AT Log. After HTTPPOST, it does not get any response from device and timeouts (I have a 5s timeout)

Initializing GSM

[AT START]
Command => AT
Response[9 bytes] =>
AT

OK
[AT END: T => 42 ms]

[AT START]
Command => ATE0
Response[11 bytes] =>
ATE0

OK
[AT END: T => 44 ms]

[AT START]
Command => AT+CPIN?
Response[22 bytes] =>

+CPIN: READY

OK
[AT END: T => 46 ms]

[AT START]
Command => AT+GSN
Response[25 bytes] =>

860657058408150

OK
[AT END: T => 48 ms]

[AT START]
Command => AT+CMGF=1
Response[6 bytes] =>

OK
[AT END: T => 44 ms]

[AT START]
Command => AT+CREG?
Response[20 bytes] =>

+CREG: 0,1

OK
[AT END: T => 46 ms]

[AT START]
Command => AT+COPS?
Response[29 bytes] =>

+COPS: 0,0,“airtel”

OK
[AT END: T => 47 ms]

[AT START]
Command => AT+QISTAT
Response [27 bytes] =>

OK

STATE: IP INITIAL
[AT END: T => 47 ms]

IP Status => IP INITIAL

[AT START]
Command => AT+QISTAT
Response [27 bytes] =>

OK

STATE: IP INITIAL
[AT END: T => 47 ms]

IP Status => IP INITIAL

[AT START]
Command => AT+CGATT?
Response[19 bytes] =>

+CGATT: 1

OK
[AT END: T => 46 ms]

[AT START]
Command => AT+QIFGCNT=0
Response[6 bytes] =>

OK
[AT END: T => 44 ms]

[AT START]
Command => AT+QICSGP=1,“airtelgprs.com
Response[6 bytes] =>

OK
[AT END: T => 51 ms]

[AT START]
Command => AT+QIREGAPP
Response[6 bytes] =>

OK
[AT END: T => 43 ms]

[AT START]
Command => AT+QISTAT
Response [25 bytes] =>

OK

STATE: IP START
[AT END: T => 48 ms]

IP Status => IP START
GPRS Status 0

[AT START]
Command => AT+QISTAT
Response [25 bytes] =>

OK

STATE: IP START
[AT END: T => 47 ms]

IP Status => IP START
Activating PDP Context

[AT START]
Command => AT+QIACT
Response[6 bytes] =>

OK
[AT END: T => 544 ms]

[AT START]
Command => AT+QISTAT
Response [27 bytes] =>

OK

STATE: IP GPRSACT
[AT END: T => 49 ms]

[AT START]
Command => AT+QHTTPURL=32
Response [11 bytes] =>

CONNECT
[AT END: T => 46 ms]

[AT START]
Command => http://vltgw.trakomatic.in:9140
Response [6 bytes] =>

OK
[AT END: T => 48 ms]

[AT START]
Command => AT+QHTTPPOST=14
Timeout receiving AT response for command => AT+QHTTPPOST=14
[AT END: T => 5011 ms]

Also, when I try to initate a new transaction, the HTTPURL fails as below

[AT START]
Command => AT+QHTTPURL=31
Response [9 bytes] =>

ERROR
[AT END: T => 47 ms]

It seems the earlier HTTP Transaction did not finish. How can I terminate / end a transaction without deactivating the PDP?

1 Like

Bad mistake, I missed the carriage return character (\r) in the HTTPOST command… :frowning: If anyone facing the same issue, make sure you have the \r character appended to each AT command.

You need to increase \r\n, but it is not included in the length of the URL

It seems the earlier HTTP Transaction did not finish. How can I terminate / end a transaction without deactivating the PDP?

I’ve dealt with it as to either wait for the timeout event to occur or use at+qideact at the end of my post/get requests. Or you could simply CONNECT to a different url and send another request there. Example:

AT+QHTTPURL=49<\r><\n>
""myLink""
AT+QHTTPPOST=587,60,60<\r><\n>
PATCH anydata.json HTTP/1.1<\r><\n>
Host: hostNameLink<\r><\n>
<\r><\n>
Content-Type: application/json<\r><\n>
Connection: Keep-Alive<\r><\n>
Content-Length: 443<\r><\n>
<\r><\n>
{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"88":31,"60":420,"61":18,"62":2}
AT+QHTTPURL=52<\r><\n>
""myOtherLink""
AT+QHTTPCFG="requestheader",0<\r><\n>
AT+QHTTPGET=30<\r><\n>
AT+QHTTPREAD=30<\r><\n>

Making requests keep connection alive.