GPRS v1.4 returns HTTP & TCP garbage

Hi friends,
I cannot figure this one out. I’ve got the Uno and v1.4 of the GPRS shield.

I’ve put together 2 different examples, one with TCP and the other HTTP… no success. I get garbage data like this:
(notice i put brackets around the ‘c’ to because the forum won’t let me post links as a new member and prevents me from posting…)

AT+CIPSTART="TCP","google.[c]om","80"
CONNECT OK

AT+CIPSEND=20
>GET / HTTP/1.1
Host: google.[c]com
Connection: close


SEND OK

HTTP/1.1 400 Bad Request
Date: Sat, 10 Aug 2013 16:23:01 GMT
Serctpn3c-;8P T<lue>>eeru>d2eedh
CLOSED

AT+CIPCLOSE
ERROR

AT+CIPSHUT
SHUT OK

Don’t mind that it says “400 Bad Request” this is just an example. My main problem is that I dont receive the entire payload because of this gibberish:
“Serctpn3c-;8P T>eeru>d2eedh”

My HTTP one does similar things. Is this a hardware issue?

The example code will be in the next post

[code]#include <SoftwareSerial.h>
SoftwareSerial mySerial(7, 8);

int8_t answer;
int onModulePin= 2;
char aux_str[50];

char ip_data[]=“GET / HTTP/1.1\r\nHost: google.[c]om\r\nConnection: close\r\n\r\n”;

void setup(){

mySerial.begin(19200); // SOFTWARE COM
Serial.begin(19200); // HUMAN COM
delay(500);

pinMode(onModulePin, OUTPUT);
mySerial.begin(19200);    

Serial.println("Starting...");
power_on();

delay(3000);

Serial.println("Connecting to the network...");

while( sendATcommand2("AT+CREG?", "+CREG: 0,1", "+CREG: 0,5", 1000)== 0 ){
  
}

}

void loop()
{

if (Serial.available())
switch(Serial.read())
{
case ‘h’:
SubmitHttpRequest();
break;
case ‘i’:
// Closes the socket
sendATcommand2(“AT+CIPCLOSE”, “CLOSE OK”, “ERROR”, 10000);
sendATcommand2(“AT+CIPSHUT”, “OK”, “ERROR”, 10000);
delay(10000);
break;
}
if (mySerial.available()) {
Serial.write(mySerial.read());
}

}

void SubmitHttpRequest() {

// Selects Single-connection mode
if (sendATcommand2("AT+CIPMUX=0", "OK", "ERROR", 1000) == 1)
{
    // Waits for status IP INITIAL
    while(sendATcommand2("AT+CIPSTATUS", "INITIAL", "", 500)  == 0 );
    delay(5000);
    
    // Sets the APN, user name and password
    if (sendATcommand2("AT+CSTT=\"fast.tmobile.[c]om\",\"user_name\",\"password\"", "OK",  "ERROR", 30000) == 1)
    {            
        // Waits for status IP START
        while(sendATcommand2("AT+CIPSTATUS", "START", "", 500)  == 0 );
        delay(5000);
        
        // Brings Up Wireless Connection
        if (sendATcommand2("AT+CIICR", "OK", "ERROR", 30000) == 1)
        {
            // Waits for status IP GPRSACT
            while(sendATcommand2("AT+CIPSTATUS", "GPRSACT", "", 500)  == 0 );
            delay(5000);
            
            // Gets Local IP Address
            if (sendATcommand2("AT+CIFSR", ".", "ERROR", 10000) == 1)
            {
                // Waits for status IP STATUS
                while(sendATcommand2("AT+CIPSTATUS", "IP STATUS", "", 500)  == 0 );
                delay(5000);
                Serial.println("Openning TCP");
                
                // Opens a TCP socket
                if (sendATcommand2("AT+CIPSTART=\"TCP\",\"google.[c]om\",\"80\"", "CONNECT OK", "CONNECT FAIL", 30000) == 1)
                {
                    Serial.println("Connected");
                    
                    // Sends some data to the TCP socket
                    sprintf(aux_str,"AT+CIPSEND=%d", strlen(ip_data));
                    if (sendATcommand2(aux_str, ">", "ERROR", 10000) == 1)    
                    {
                        sendATcommand2(ip_data, "OK", "ERROR", 10000);
                    }
                    

                }
                else
                {
                    Serial.println("Error openning the connection");
                }  
            }
            else
            {
                Serial.println("Error getting the IP address");
            }  
        }
        else
        {
            Serial.println("Error bring up wireless connection");
        }
    }
    else
    {
        Serial.println("Error setting the APN");
    } 
}
else
{
    Serial.println("Error setting the single connection");
}

}

void power_on() {
uint8_t answer=0;

// checks if the module is started
answer = sendATcommand2("AT", "OK", "OK", 2000);
if (answer == 0) {
  Serial.println("Powering up...");
  
  pinMode(9, OUTPUT); 
  digitalWrite(9,LOW);
  delay(1000);
  digitalWrite(9,HIGH);
  delay(2000);
  digitalWrite(9,LOW);
  delay(3000);

  Serial.println("Waiting...");
    // waits for an answer from the module
    while(answer == 0){  
        // Send AT every two seconds and wait for the answer
        answer = sendATcommand2("AT", "OK", "OK", 2000);
        mySerial.println(answer);
      }
}

}

int8_t sendATcommand2(char* ATcommand, char* expected_answer1, char* expected_answer2, unsigned int timeout){

//Serial.print("Sending: ");
//Serial.println(ATcommand);

uint8_t x=0,  answer=0;
char response[100];
unsigned long previous;

memset(response, '\0', 100);    // Initialize the string

delay(100);

while( mySerial.available() > 0) mySerial.read();    // Clean the input buffer

mySerial.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(mySerial.available() != 0){    
        response[x] = mySerial.read();
        x++;
        // check if the desired answer 1  is in the response of the module
        if (strstr(response, expected_answer1) != NULL)    
        {
            answer = 1;
        }
        // check if the desired answer 2 is in the response of the module
        else if (strstr(response, expected_answer2) != NULL)    
        {
            answer = 2;
        }
    }
}
// Waits for the asnwer with time out
while((answer == 0) && ((millis() - previous) < timeout));    

Serial.print("Received--: ");
Serial.println(response);
return answer;

}
[/code]

This forum is dead. If you are looking for the answer to this question, I would suggest going to forum.arduino.cc they have a very active community.

The problem i discovered is with the 100 char limit in overflowing text. I’ve yet to find a solution on how to fix it.