Quectel AT commands and http

Status
Not open for further replies.

Fyod

Well-known member
I'm connecting a Quectel GSM module to my T3.1 and I'm having trouble with connecting to the internet. Facts: SMS works, SIM is internet ready and tested in a phone, I have gotten a positive "CONNECT" response on a TCPIP query I did earlier, the web server I'm attempting to communicate to is OK, tested that well enough, I get the local IP upon AT query echoed OK, the issue is not binary size or memory related, I am succesfully entering the APN creds before the below code, I recieve "SERVER OK".

Code:
  gsm.SimpleWriteln("AT+QILOCIP");  // IP address
  delay(5000);  // Read until serial buffer is empty
  gsm.WhileSimpleRead();

^^ Works, echoes module's IP.

Code:
gsm.SimpleWriteln("AT+QHTTPGET?");
delay(5000);
gsm.WaitResp(10000, 10, "OK");
gsm.SimpleWriteln("AT+QHTTPURL=54,30");
//delay(5000);
gsm.WaitResp(10000, 10, "CONNECT");
//gsm.WhileSimpleRead();
gsm.SimpleWriteln("http://xx.xx.xx.xx/xxxx/xxx.php?xx1=999&xx2=000");
delay(5000);
gsm.WaitResp(10000, 10, "OK");
gsm.WhileSimpleRead();
gsm.SimpleWriteln("AT+QHTTPREAD=30");
delay(5000);
gsm.WaitResp(10000, 10, "CONNECT");
gsm.WhileSimpleRead();

^^ None of this works, or it gets stuck on the first AT. The '54' URL byte size correcsponds the URL when it isn't 'xx'. Also tried getting out of data mode before entering AT mode using:

Code:
delay(1000);
gsm.SimpleWriteln("+++");
delay(1000);

... but that didn't help. I also tried this:

Code:
gsm.SimpleWriteln("AT+QIOPEN=\"TCP\",\"xx.xx.xx.xx\", 80");
delay(9000);
gsm.WaitResp(10000, 10, "CONNECT OK");
gsm.WhileSimpleRead();     
delay(2000);
numdata=inet.httpGET("xx.xx.xx.xx", 80, "/xx/xx.php?xx1=999", msg, 50);
delay(9000);
gsm.WaitResp(10000, 10, "SEND OK");
gsm.WhileSimpleRead(); 
//Print the results.
Serial.println("\nNumber of data received:");
Serial.println(numdata);

... and it would seem connect and send is OK. But the message is always 30 (or whatever msg length value is set, tried 300) of the following characters and numdata is always full, 30 in this example.

Code:
ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇ

Above inetHTTP corresponds to this is inet.cpp:

Code:
int InetGSM::httpGET(const char* server, int port, const char* path, char* result, int resultlength)
{   
gsm.SimpleWrite("GET ");
gsm.SimpleWrite(path);
gsm.SimpleWrite(" HTTP/1.1\nHost: ");
gsm.SimpleWrite(server);
gsm.SimpleWrite("\r\n");
gsm.SimpleWrite("User-Agent: Arduino");
gsm.SimpleWrite("\r\n");
gsm.SimpleWrite("<CTRL+Z>");

delay(50);
#ifdef DEBUG_ON
    Serial.println("DB:SENT");
#endif  
int res= gsm.read(result, resultlength);
return res;
}

The internets contain little to no info on these modules, although I have tried what little suggestions there are out there. I'm following the "HTTP Service AT Commands GSM_HTTP_ATC_V1.1" manual and examples directly published by Quectel. I don't know if I should be establishing a TCPIP to the server before using the HTTP commands... Any help is appreciated. I'm stumped at this point.
 
Status
Not open for further replies.
Back
Top