setup() resets from loop, when I add parameters to http get `?identity=%2B0123456789&identityType=1` I am trying to call a HTTP GET using my Arduino via SIM900A.

When I run the commands manually via the USB port, I am able to get the commands to run. Now, when I put the same sequence on arduino, the setup() is called repeatedly after the sendATcommand(httpAuthCommand, "OK", 2000);. Looks like a reset issue.

I read, this link to put all my code into loop to avoid the setup() reset issue. But seems like this is did not fix the issue.

I have debugged it to this one change.

This Works

char httpAuthCommand[] = "AT+HTTPPARA=\"URL\",\"http://www.m2msupport.net/m2msupport/http_get_test.php\"" ;


This Does Not work

char httpAuthCommand[] = "AT+HTTPPARA=\"URL\",\"http://1.1.1.1:8080/mytomcatservice/mypath/mycommand/Request?identity=%2B1234567890&amp;identityType=1\"" ;


I debugged this a bit more, it does not work when I add ?identity=%2B0123456789&amp;identityType=1 to the httpAuthCommand. Something crazy while sending parameters ??

In loop()

sendATcommand(httpAuthCommand, "OK", 2000); 


sendATcommand method

int8_t sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout){

    uint8_t x=0,  answer=0;
    char response[100];
    unsigned long previous;
    memset(response, '\0', 100);    // Initialice the string
    delay(100);
    while( Serial.available() &gt; 0) Serial.read();    // Clean the input buffer
    Serial.println(ATcommand);    // Send the AT command 
    x = 0;
    previous = millis();
    // this loop waits for the answer
    do{
        // if there are data in the UART input buffer, reads it and checks for the asnwer
        if(Serial.available() != 0){    
            response[x] = Serial.read();
            x++;
            // check if the desired answer is in the response of the module
            if (strstr(response, expected_answer) != NULL)    
            {
                answer = 1;
            }
        }
    // Waits for the asnwer with time out
    }while((answer == 0) &amp;&amp; ((millis() - previous) &lt; timeout));    

    return answer;
}


Raw commands work on Chrome


  http://www.m2msupport.net/m2msupport/http_get_test.php 
  
  http://1.1.1.1:8080/mytomcatservice/mypath/mycommand/Request?identity=%2B918177900460&amp;identityType=1


My Guess

I am missing some escape sequence characters in the command (especially in the parameters section ?identity=%2B0123456789&amp;identityType=1).
"Something crazy while sending parameters ??"

Possibly your power supply is to weak so 5V drops low and the processor resets when the transmitter sends a message.