5

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?

Bence Kaulics
  • 6,353
  • 12
  • 33
  • 60
Sergio
  • 741
  • 1
  • 8
  • 22
  • 7
    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. – Sergio Oct 07 '14 at 09:20
  • 1
    Do either AT+CMEE or AT+CEER give you any more useful error info? – brhans Oct 08 '14 at 01:05
  • @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? – PeterJ Oct 08 '14 at 10:32
  • @PeterJ, It was a typo indeed. I meant the second parameter. If I use '2', for example, it works. – Sergio Oct 08 '14 at 10:50
  • 2
    Their (SimCom) [documentation](http://wm.sim.com/upfile/2013424141114f.pdf) 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. – Fizz Jan 06 '15 at 17:07
  • Maybe http://www.cooking-hacks.com/forum/viewtopic.php?f=20&t=3408 will help you. – Fizz Jan 06 '15 at 17:14
  • I have the same problem looks like an network problem. When ido sapbr error. How you resolved it? –  Feb 23 '15 at 18:22
  • Seconding @brhans comment; try AT+CEER=0 to get a string error back. – jjmilburn Feb 23 '15 at 20:34
  • @jjmilburn, I never tried that suggestion, I left this aside for a while. I'll try that and give some feedback. – Sergio Feb 24 '15 at 09:10
  • @leo I still didn't solve it. If you try the suggested it share the results as well, please! – Sergio Feb 24 '15 at 09:11

3 Answers3

5

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.

Dwayne Reid
  • 23,390
  • 2
  • 35
  • 67
Paul
  • 875
  • 7
  • 18
2

Close the bearer first

AT+SAPBR=0,1

and then open it again

AT+SAPBR=1,1

Sven B
  • 5,072
  • 8
  • 24
Vincent Alex
  • 193
  • 1
  • 9
0

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 ..

  • 1
    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! – Sergio Feb 20 '15 at 14:44
  • 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.. – Ayla kumar Mar 04 '15 at 11:23
  • 2
    On error, I suceed to close the bearer first AT+SAPBR=0,1 and then open it again AT+SAPBR=1,1. –  Feb 27 '15 at 14:20