1

I'm trying to build a device for my startup IoT-related, using an A7672S.

Here is the code:

mySerial.println("AT+HTTPINIT";
checkresponse("OK\r\n");

mySerial.println("AT+HTTPPARA=\"URL\",\"http://" + host + resources + "\"");
checkresponse("OK\r\n");
  
mySerial.println("AT+HTTPPARA=\"CONTENT\",\"application/json\"");
checkresponse("OK\r\n");

String st = "AT+HTTPDATA=";
int pdl = postdata.length();
st += String(pdl);
st += ",15000";
mySerial.println(st);
checkresponse("DOWNLOAD");

mySerial.println(postdata);
checkresponse("OK\r\n");

mySerial.println("AT+HTTPACTION=1");
checkresponse("+HTTPACTION: 1,200");

if (BuildINString2.indexOf("+HTTPACTION: 1,200") != -1) {
  Serial.println("POST DONE");
} else
  Serial.print("ERROR POST: "); 
  Serial.println(BuildINString2);
}

mySerial.println("AT+HTTPTERM");
checkresponse("OK\r\n");
    
// In the check function, we pass the check variable to check different possible responses of sim like ok, error, etc
    
void checkresponse(String check) {  
  int start = millis();
  BuildINString2="";
  while (true) {
    if (mySerial.available() > 0) {
      inData =mySerial.read();
      BuildINString2 = BuildINString2 + char(inData);    
    }

    if (BuildINString2.indexOf(check)! = -1) {
      delay(100);
      return;
    }

    if (millis()-start > 3000) { 
      delay(100);   
      Serial.println("SIM TIMEOUT");
      return;
    }
  }
}

How can we speed up the POST time? Because in my last module (SIM7600), I used CHTTPACTION which was POSTing in less than 500 ms, but on the A7672s, it's taking more than 1 s.

Can someone confirm possible issues or any other method for the fast posting of data?

Also, in this HTTP method, is HTTPTERM required for every POST or change in URL point or when it's required?

3
  • your code does not compile Commented Jul 7, 2022 at 0:30
  • It's unclear whether the part that you're asking about is the collection of statements (takes over a second to go over that loop) or whether a specific AT command you send takes over a second (from the MySerial.println to checkmyresponse return). You need to provide some more information for us to be able to help. Commented Jul 7, 2022 at 5:10
  • takes over a second to go over that loop ( i wrote Data was posting in 1 second in old simmodule, as old sim module - Sim7600 support Chttp action that simA7672 doesn't support so had to use normal HTTP command but not CHTTP so wondering ways to make posting faster if possible) Commented Jul 11, 2022 at 4:12

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.