SIM900 TCP connection issue

I am having a strange issue where if I try and create a TCP connection to my service, it doesn't work. But any other website, such as google, works fine. The serial monitor output is also slightly different, but I cannot see any difference in the code. I am using this module for communications.

This is the method that I am using:

void SendPost()
{
  Serial1.println("AT+CGATT?");
  delay(1000); 
  ShowSerialData();
 
  Serial1.println("AT+CSTT=\"everywhere\"");//start task and setting the APN,
  delay(1000); 
  ShowSerialData();
 
  Serial1.println("AT+CIICR");//bring up wireless connection
  delay(3000); 
  ShowSerialData();
 
  Serial1.println("AT+CIFSR");//get local IP adress
  delay(2000); 
  ShowSerialData();
 
  Serial1.println("AT+CIPSPRT=0");
  delay(3000); 
  ShowSerialData();
 
  Serial1.println("AT+CIPSTART=\"tcp\",\"www.google.com/\",\"80\"");//start up the connection //https://rocky-garden-56471.herokuapp.com/breadcrum/lifecycle/register
  delay(5000); 
  ShowSerialData();
 
  Serial1.println("AT+CIPSEND");//begin send data to remote server
  delay(4000);
  ShowSerialData();
  
  Serial1.println("{\"device_info\":\"breadcrum-prototype-a\"}");  
  delay(500);
  ShowSerialData();
 
  Serial1.println((char)26);//sending
  delay(5000);//waitting for reply, important! the time is base on the condition of internet 
  
  Serial1.println(); 
  ShowSerialData();
 
  Serial1.println("AT+CIPCLOSE");//close the connection
  delay(100);
  ShowSerialData();
}

Using 'www.google.com' I get an OK upon tcp connection (with an expected error on the data as I try to POST):

Setup CompleteAT+CGATT?

+CGATT: 1

OK
AT+CSTT="everywhere"

OK
AT+CIICR

OK
AT+CIFSR

100.66.4.95
AT+CIPSPRT=0

OK
AT+CIPSTART="tcp","www.google.com/","80"

OK

STATE: IP STAAT+CIPSEND

ERROR
{"device_info":"breadcrum-prototype-a"}


AT+CIPCLOSE

ERROR

But using the address I actually want to post data to (https://rocky-garden-56471.herokuapp.com/breadcrum/lifecycle/register), it cannot connect and I get this:

Setup CompleteAT+CGATT?

+CGATT: 1

OK
AT+CSTT="everywhere"

OK
AT+CIICR

OK
AT+CIFSR

100.66.4.95
AT+CIPSPRT=0

OK
AT+CIPSTART="tcp","https://rocky-garden-56471.herokuapp.com/breAT+CIPSEND

ERROR
{"device_info":"breadcrum-prototype-a"}


AT+CIPCLOSE

ERROR

This errors on connection, and you can also see that the full address isn't printed out for some reason. Does anyone have any idea what could be causing this issue?

Thanks :slight_smile:

I have been informed that I should switch to different commands, which I have. My code now looks like:

void SubmitHttpRequest()
{
  Serial1.println("AT+CSQ");
  delay(100); 
  ShowSerialData();// this code is to show the data from gprs shield, in order to easily see the process of how the gprs shield submit a http request, and the following is for this purpose too.
 
  Serial1.println("AT+CGATT?");
  delay(100); 
  ShowSerialData();
 
  Serial1.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");//setting the SAPBR, the connection type is using gprs
  delay(1000); 
  ShowSerialData();
 
  Serial1.println("AT+SAPBR=3,1,\"APN\",\"everywhere\"");//setting the APN, the second need you fill in your local apn server
  delay(4000); 
  ShowSerialData();

 //Enable GPRS
  Serial1.println("AT+SAPBR=1,1");
  delay(2000); 
  ShowSerialData();

  //Query if connection is setup correctly, return IP address if it is 
  Serial1.println("AT+SAPBR=2,1");
  delay(2000); 
  ShowSerialData();

  Serial1.println("AT+HTTPSSL=1"); //enable HTTPS
  delay(2000); 
  ShowSerialData();
 
  Serial1.println("AT+HTTPINIT"); //init the HTTP request 
  delay(2000); 
  ShowSerialData();

  Serial1.println("AT+HTTPPARA=\"CID\",1");//setting the SAPBR, for detail you can refer to the AT command mamual
  delay(2000); 
  ShowSerialData();
  
  Serial1.println("AT+HTTPPARA=\"URL\",\"https://rocky-garden-56471.herokuapp.com/breadcrum/lifecycle/register\"");
  delay(6000); 
  ShowSerialData();

  Serial1.println("AT+HTTPPARA=\"CONTENT\",\"application/json\"");
  delay(3000); 
  ShowSerialData();  

  Serial1.println("AT+HTTPDATA=200,10000");// setting the httppara, the second parameter is the website you want to access
  delay(3000);
  ShowSerialData();
 
  Serial1.println("{\"device_info\":\"breadcrum-prototype-a\"}");// setting the httppara, the second parameter is the website you want to access
  delay(3000); 
  ShowSerialData();
 
  Serial1.println("AT+HTTPACTION=1");//submit the request //0:READ 1:POST 2:HEAD
  delay(10000);//the delay is very important, the delay time is base on the return from the website, if the return datas are very large, the time required longer.
  ShowSerialData();
 
  Serial1.println("AT+HTTPREAD");
  delay(1000); 
  ShowSerialData();

  Serial1.println("AT+HTTPTERM");
  delay(1000); 
  ShowSerialData();
 
  Serial1.println("");
  delay(100);
}

This gives me the result of:

AT+CSQ

+CSQ: 18,0

OK
AT+CGATT?

+CGATT: 1

OK
AT+SAPBR=3,1,"CONTYPE","GPRS"

OK
AT+SAPBR=3,1,"APN","everywhere"

OK
AT+SAPBR=1,1

ERROR
AT+SAPBR=2,1

+SAPBR: 1,1,"31.94.203.234"

OK
AT+HTTPSSL=1

OK
AT+HTTPINIT

OK
AT+HTTPPARA="CID",1

OK
AT+HTTPPARA="URL","https://rocky-garden-56471.herokuapp.com/breAT+HTTPPARA="CONTENT","application/json"

OK
AT+HTTPDATA=100,10000

DOWNLOAD

ERROR
AT+HTTPREAD

OK
AT+HTTPTERM

OK

Which is incredibly close, as (ignore the connection error which has appeared because I was already connected) I only have the single error on download. I can’t seem to figure out why this is happening, changing delays and data size doesn’t appear to make any difference. Any idea what could be causing this?