Skip to content

http GET don't work after sleep #9

@jaka87

Description

@jaka87

Im scratching my head for few days with this one. When i do GET request it works but when I put module to sleep and then do request it doesn't.

Here is my code:

#include <BareBoneSim800.h>

BareBoneSim800 sim800("internet.bob.si");  //to declare the library with an APN
const char resource[] = "m2msupport.net/m2msupport/test.php";

 const int port = 80;

void setup() {
  Serial.begin(9600);
  sim800.begin();
  while(!Serial);

  Serial.println("Testing GSM module For GPRS Connectivity");
  delay(8000); // this delay is necessary, it helps the device to be ready and connect to a network

  Serial.println("Should be ready by now");
    bool deviceAttached = sim800.isAttached();
  if (deviceAttached)
    Serial.println("Device is Attached");
  else
    Serial.println("Not Attached");

}

void loop() {
  sim800.disableSleep();
  sim800.setFullMode();

// Connecting the the GPRS APN Network
 Serial.println(" Connecting to APN");
 bool netConnect = sim800.gprsConnect();
 if(netConnect)
  Serial.println("Connected to Network");
 else
  Serial.println("An Error Occured");

  if(netConnect)
  {    
    Serial.println("Making HTTP Get Request");
    String result = sim800.sendHTTPData(resource);
    Serial.println("Received Info: ");
    Serial.println(result);
  
  }
    
    sim800.closeHTTP(); // disconnect from server
    sim800.gprsDisconnect();

    bool sleepActivated = sim800.enterSleepMode();    
      if(sleepActivated)
        {    
         Serial.println("zzzzZZZZZZzzzzz"); 
         delay(5000); 
      }
  }  

this is debug for first request

AT+CSCLK=0

OK

AT+CFUN=1

OK

AT+CFUN=1

OK

 Connecting to APN
AT+CIPSHUT

SHUT OK

AT+CGATT=0

OK

AT+SAPBR=0,1

ERROR

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

OK

AT+SAPBR=3,1,"APN","internet.bob.si"

OK

AT+SAPBR=3,1,"USER",""

OK

AT+SAPBR=3,1,"PWD",""

OK

AT+SAPBR=1,1


OK

AT+CGATT=1

OK

AT+CIPMUX=0

OK

AT+CSTT="internet.bob.si","",""

OK

AT+CIICR

OK

AT+CIFSR

100.65.40.9

Connected to Network
Making HTTP Get Request
AT+HTTPINIT

OK

AT+HTTPPARA="CID",1

OK

AT+HTTPPARA="URL",m2msupport.net/m2msupport/test.php

OK

AT+HTTPACTION=0

OK


+HTTPACTION: 0,200,4

AT+HTTPREAD

+HTTPREAD: 4
test
OK

Received Info: 
AT+HTTPREAD

+HTTPREAD: 4
test
OK

AT+HTTPTERM

OK

AT+CIPSHUT

SHUT OK

AT+CGATT=0

+SAPBR 1: DEACT

OK

AT+SAPBR=0,1

ERROR

AT+CFUN=0

+CPIN: NOT READY

OK

AT+CSCLK=2

OK

zzzzZZZZZZzzzzz

here is the second one

AT+CSCLK=0


OK

AT+CFUN=1


+CPIN: READY

OK


SMS Ready


Call Ready

AT+CFUN=1


OK

 Connecting to APN
AT+CIPSHUT


SHUT OK

AT+CGATT=0


OK

AT+SAPBR=0,1


ERROR

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


OK

AT+SAPBR=3,1,"APN","internet.bob.si"


OK

AT+SAPBR=3,1,"USER",""


OK

AT+SAPBR=3,1,"PWD",""


OK

AT+SAPBR=1,1



OK

AT+CGATT=1


OK

AT+CIPMUX=0


OK

AT+CSTT="internet.bob.si","",""


OK

AT+CIICR


OK

AT+CIFSR


100.67.23.115

Connected to Network
Making HTTP Get Request
AT+HTTPINIT


OK

AT+HTTPPARA="CID",
Received Info: 

AT+HTTPTERM


OK

AT+CIPSHUT


SHUT 
AT+CFUN=0


+SAPBR

OK

FF


AT+CSCLK=0


OK

AT+CFUN=1


+CPIN:

SMS Ready


Call Ready

Any idea how to fix it ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions