Dear All,
I experiencing an issue since a couple of day!!!
I am trying so send a URL with a SIM900 with the command HTTPPARA.
I am not sure but I suggest a problem of Arduino Mini Pro buffer with a limitation of 64byte.
Here is the final URL to be send
AT+HTTPPARA="URL","http://xxxxx.dyndns.org:8080/gprmc/Data?acct=sysadmin&dev=bipme&cid=11621&mnc=03&mcc=2&a=01grc$PM,,,,,,"
Here is my code
/* Sets url */
snprintf(str_aux1, sizeof(str_aux1), "%s=\"URL\",\"http://%s:%s/%s%s", str_aux1,_http_srv,_http_port,_http_path,_http_script);
// SEND COMMAND
// http://xxxxx.dyndns.org:8080/gprmc/Data?
_cell.print(str_aux1);
_cell.print(F("acct="));
_cell.print(_acct);
_cell.print(F("&"));
_cell.print(F("dev="));
_cell.print(_dev); // See page 36 of OpenGTS Manuel
_cell.print(F("&"));
// SEND FIX
// data = cid=11621&mnc=03&mcc=2&a=01grc$PM,,,,,,
for(byte i=0; i < strlen(data); i++)
{
_cell.print(data[i]);
}
// Add the " to close the command
_cell.println("\"\r");
// READ THE RESPONSE
int x = 0;
int answer = 0;
unsigned long previous;
// Clean the buffer
memset(buffer, '\0', BUFFERSIZE); // BUFFERSIZE is 200
Serial.println(F(""));
// Clean _cell
while(_cell.available() > 0) _cell.read();
previous = millis();
// Start do loop until the while condition is met (timeout and expected answers)
do{
// If _cell is available
if(_cell.available() > 0)
{
if(x < BUFFERSIZE-1)
{
char r = _cell.read();
buffer[x] = r;
// To print the response
Serial.print(buffer[x]);
x++;
// IF OK IS RED, CHANGE ANSWER TO 1 TO LEAVE THE LOOP
if (strstr(buffer, "OK") != NULL)
{
answer = 1;
buffer[x]='\0';
}
} // end x<BUFFERSITE
else
{
#ifdef DEBUG
sprintln(F("*Overflow*"));
#endif
}
}
else{
//Serial.println(F("N/A"));
//Serial.println(x);
}// End cell available
} // end do
while((answer == 0) && ((millis() - previous) < 10000));
// Leave to loop if answer is true and if previous exceed 10 sec
if (answer == 1)
{
// Print while success
#ifdef DEBUG_SEND
//sprintln(OK_RESPONSE);
sprintln(F("OK"));
sprint(F("URL:\t\t\t"));
sprintln(buffer);
#endif
/*
Here is the rest of the code which works
//HTTPACTION:0
//HTTPREAD:1,200
*/
}
else // END HTTPPARA URL
{
#ifdef DEBUG_SEND
sprintln(buffer);
sprintln(F("Err setting url"));
#endif
answer = -101;
}
What happen?
Here is the the print of
// To print the response
Serial.print(buffer[x] ) ;
Response:
AT+HTTPPARA="URL","http://xxxxx.dyndns.org:8080/gprmc/Data?acct=sysadmin&dev=bipme&cid=11621&mnc=03&mcc=2&a=01grc$PM,,,,,,
(The correct response should have an 'OK' below below the last coma)
You can observe, there is not the " which close the command.
Some time, I have this with a 0 or a K
AT+HTTPPARA="URL","http://xxxxx.dyndns.org:8080/gprmc/Data?acct=sysadmin&dev=bipme&cid=11621&mnc=03&mcc=2&a=01grc$PM,,,,,,"K
When I have the error message
Err setting url
it's because the URL was not correct and it append if I forget the "
I really why it's does not work.
Do you have an idea?
It a relation with
This hardware allows the Atmega chip to receive serial communication even while working on other tasks, as long as there room in the 64 byte serial buffer
.
Thank for your help