5
\$\begingroup\$

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?

\$\endgroup\$
10
  • 7
    \$\begingroup\$ How come it's not? I'm using a GPRS module on my design, which is giving me trouble. If this isn't the place where people would know about AT commands and GSM modules, I'm really lost. SIM900 is being one of the most used gsm/gprs modules around electonics and nowadays, in my opinion, electronics is really much more than diodes and transistors. So let's just skip all those arduino questions, because arduino is rather a toy, not a microcontroller. Or just skip al microcontroller questions, because microcontrollers are programmable. Not electronic. \$\endgroup\$
    – Sergio
    Commented Oct 7, 2014 at 9:20
  • 1
    \$\begingroup\$ Do either AT+CMEE or AT+CEER give you any more useful error info? \$\endgroup\$
    – brhans
    Commented Oct 8, 2014 at 1:05
  • \$\begingroup\$ @Sergio, not sure if this is just a typo in your question, but for AT+SAPBR=? and all other AT+SAPBR variants the first parameter looks like the command type, the second is the bearer ID, does that explain the results you're getting? \$\endgroup\$
    – PeterJ
    Commented Oct 8, 2014 at 10:32
  • \$\begingroup\$ @PeterJ, It was a typo indeed. I meant the second parameter. If I use '2', for example, it works. \$\endgroup\$
    – Sergio
    Commented Oct 8, 2014 at 10:50
  • 2
    \$\begingroup\$ Their (SimCom) documentation is so gawd damn awful (and on a pretty slow server) that their chips really don't deserve to be bought. It made me remember what Alan Cox once said about a different hardware company... something about their brains not speaking English. I can see similar questions about this SAPBR command on the net... and nobody knows much. I would bug the company with this problem, if I had any pull with them. Good luck. \$\endgroup\$ Commented Jan 6, 2015 at 17:07

3 Answers 3

5
\$\begingroup\$

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.

\$\endgroup\$
1
2
\$\begingroup\$

Close the bearer first

AT+SAPBR=0,1

and then open it again

AT+SAPBR=1,1

\$\endgroup\$
0
\$\begingroup\$

i think there is a small misconception with that command ...just power down and on and execute the above sequence commands it works damn sure..actually when once AT+SAPBR=1,1 is executed it automatically connected so again when executed this command it automatically replies error pls check this ..

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Thanks for the reply, but I'm not sure I follow. You mean the device must be power cycled every time? Could you please clarify what do you mean by "actually when once AT+SAPBR=1,1 is executed it automatically connected so again when executed this command it automatically replies error"? Thanks! \$\endgroup\$
    – Sergio
    Commented Feb 20, 2015 at 14:44
  • 2
    \$\begingroup\$ On error, I suceed to close the bearer first AT+SAPBR=0,1 and then open it again AT+SAPBR=1,1. \$\endgroup\$
    – user68781
    Commented Feb 27, 2015 at 14:20
  • \$\begingroup\$ I think it gives error only in the case of already being connected,and again we are attempting to connect,once power it down and on and execute the above commands sequentially,surely this works.. \$\endgroup\$
    – Ayla kumar
    Commented Mar 4, 2015 at 11:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.