Electronic – SIM900 Error on AT Command AT+SAPBR=1,1

at commandsgprsgsmmbedsim900

I intend to send some information through GET method to a php page using the SIM900 module.

I tried the following sequence of commands with success.

AT+CSQ
AT+CGATT?
AT+SAPBR=3,1,"CONTYPE","GPRS"
AT+SAPBR=3,1,"APN","internet"
AT+SAPBR=1,1
AT+HTTPINIT
AT+HTTPPARA="URL","www.my_URL.com/stuff.php?variable=TEST"
AT+HTTPACTION=0
AT+HTTPREA

Note that my service provider doesn't require username & password for accessing, also "internet" is the name of the APN.

Afterwards, I wrote a program on the mbed, that sends this code to the module, then wait for a pre-determined amount of time, read the response and proceed.

I started getting an error specifically on the AT+SAPBR=1,1 command. I tried the commands manually and now I always get the error on this command. This is the comand that opens the bearer.

What I have tried: On the AT+SAPBR=? command, the second parameter is the bearer ID, so I tried using, for instance, 2 instead. And it works.

I find this very strange and I'm trying to figure out why '1' as ID keeps getting me stuck?

Best Answer

I'm actually also working on a SIM900 and had the same problem.

One possible cause of the problem is that the SIM900 already has made a connection. Try re-starting the sim900 before issuing the commands.

Also I set the APN settings with the AT+CSTT= command

Below the in/output of my serial connection:

For testing purposes use this. Be sure to have the right APN settings, this will differ for other countries and ISPs.

StopSim900;
[SIM] Stopping
[SIM] Module disabled.
StartSim900;
[SIM] Starting...
[SIM] Module started
-----------DEBUG-----------//Pressed button 1 here. Initiates the HTTP get
AT+CSTT="internet","tmobile","tmobile"
AT Issued, response:
OK

AT+SAPBR=1,1
AT Issued, response:
OK

AT+HTTPINIT
AT Issued, response:
OK

AT+HTTPPARA="CID",1
AT Issued, response:
OK

AT+HTTPPARA="URL","http://www.minimalsites.com/"
AT Issued, response:
OK

AT+HTTPACTION=0
AT Issued, response:
OK

-----------DEBUG-----------//Pressed button 2 here, reads the http message
AT+HTTPREAD=20,10
AT Issued, response:
+HTTPREAD:10
>Minimal S
OK

AT+HTTPTERM
AT Issued, response:
OK

I have left my answer here for further reference.