GPRS AT Commands for the AT&T Network

By Shahram Javey

Here is a note on how to do HTTP communication with Telit GM862 on the AT&T network using the module’s Easy GPRS AT commands (full AT commands reference) . To use the network you’ll a data plan and then you can use the need a userid and password, it appears that the same userid and password is used by anyone that has a data plan and wishes to connect to the AT&T network. I tried just leaving the userid/password blank, but that didn’t work. Here is the sequence of AT commands that you can use to HTTP GET a web page via the AT&T network. Note: All lines that start with AT are commands, and the following lines are the responses to these commands.

AT+CGDCONT=1,"IP","WAP.CINGULAR"
OK
AT#USERID="WAP@CINGULARGPRS.COM"
OK
AT#PASSW="CINGULAR1"
OK
AT#GPRS=0
OK
AT#GPRS=1
+IP: 10.110.125.164

OK
AT#SKTD=0,80,"www.bluehost.com"
CONNECT
GET / HTTP/1.0^m^jHost: www.bluehost.com^m^j

If  you are typing this into a terminal application,  you need to enter (control-m aka carriage-return)(control-j aka linefeed) instead of ^m^j. In a program you replace ^m^j with \r\n (\r is carriage-return which is ascii 13, and \n is line-feed which is ascii 10. In the terminal you must enter control-m followed by control-j.

In the sequence above, I explicitly deactivate the GPRS context and then reactivate it. I found that during testing, you may need to reset the module, terminate your screen application, etc., and in these cases, you may not be able to activate the GPRS context unless you deactivate it first. Oddly enough, sometimes after a complete restart the above sequence will fail at the AT#GPRS=1 command. If this happens, then I’ve found that issuing the following two commands and trying again will work: AT#MONI and AT+CMGF=1, not sure why that is the case yet.

I’ve also found that some web sites, e.g., www.google.com don’t seem to allow telnet-like connections, i.e., they immediately close a connection. So if the web site that you try to connect to results with No CARRIER line before you have had the chance to enter the HTTP GET request, then try another site.

 

Here is an example of POST issued in the Terminal.

AT#SKTD=0,80,"yourserver.com"
CONNECT
POST /cgi-bin/aqua.cgi HTTP/1.1^m^j
Content-Type: application/x-www-form-urlencoded^m^j
Content-Length: 28^m^j
Host: yourserver.com^m^j
^m^j
p1=Aqua+AQ&p2=AquaAqua+Rules^z

Here are a few additional AT&T commands that I found useful:

AT+CCLK? reads the current data and time. This is not the network time, simply the time since powered up the module.

AT#QDNS="www.google.com" executes a DNS query and returns the ip address of the host name.

AT#GPRS=1 activates the GPRS context, on success this returns the IP address of the GM862 on the AT&T network. Activating a context implies getting an IP address from the network and this will be maintained throughout the session.

AT#GPRS=0 deactivates the GPRS context. Deactivating the context implies freeing the network resources previously allocated to the device.

AT#SKTD This is the socket dial command which is request to make a TCP/UDP connection with an internet host. Once the connection has been established, the module responds with the code CONNECT. From this moment on, all the data coming in the serial port is sent to the internet host and all the data received from the host is serialized and flushed to the Terminal Equipment.

AT+CMEE=0 or 1 or 2 0 means disable error reports; 1 means enable error reports in numeric format; 2 means enable error reports in verbose format.

23 Responses to “GPRS AT Commands for the AT&T Network”

  1. Jim Says:

    Is it possible to use the GM862 like a landline data modem (e.g. to call the GM862 from a 56K modem)? I’ve been trying like crazy to get this done.

    Another solution would be if I could contact the unit from a webpage…incoming GPRS…do you know how to do this?

    • sj Says:

      When you start a GPRS session, you do get an IP address, you can pass this IP to the server, so on paper you should be able to connect to the GSM modem from a web page. According to the Telit Easy GPRS User Guide, incoming connections are possible. Please read section 2.1.2 Easy GPRS Incoming Connection section of this manual.

  2. Jim Says:

    Thank you. I think this is the direction that I’ll head. I’ve been trying to connect to my own web server, but it doesn’t want to play nice. I don’t get a “NO CARRIER”, but I don’t get a connect either. It just hangs up. Did this happen to you before?

  3. sj Says:

    Oh yes…I found the whole GPRS connection a nightmare to get working. For instance, the AT#SELINT command made a big difference to actually getting a response from the server. I’m assuming that you are actually getting an IP address as the result of creating a GPRS session?

  4. Jim Says:

    I am, about half the time. I get an IP back, but then it freezes usually when opening a socket. I have gotten a “Connect” but then freezes when I try to the “GET”. This has been quite a bit harder than I thought the Telit module would be. Did you ever end up with a stable solution?

  5. sj Says:

    Not yet, I’m afraid. I was getting close, but I had to move on. For now I’ve settled on using SMS/e-mail. Telits sends SMS, server gets these as e-mail, it is as good as GPRS in some cases. SMS also takes less power than GPRS. I’ll get back to GPRS in the next few weeks, so if you get it to work, please let me know. I understand that FTP is lot easier to get working, so may want to give that a try.

    Keep in mind that all of the AT commands need to have a re-try logic. Namely, you need to submit a AT command, wait for the result, if it fails try again – up to 4 to 5 times is common. Are you doing that?

  6. Jim Says:

    I am checking results and resending as needed. I found out via Telit that the GM862 (or at least the model I had…check the version with at+CGMR) won’t really work on the US network. I had an old version 6.04.204. If you don’t have 7. something…it won’t work. I ordered a Janus Terminus GSM864Q Module…..it works spot on and the GPRS is working great.

    It ended up i had to throw some money at the problem, but it’s working smoothly now. I post data directly to a web page now and get it into a database.

  7. Tony Says:

    Guys,
    I am currently using a GC864 fom telit and I am having the same issue as you guys are having: basically, nothing returns after I try to open a socket (e.g. AT#SKTD=0,80,”www.cnn.com”,0,0). The only thing I get back is a carriage return. And everything hangs. Can’t even get out using the “+++” command.

    I could get a ip address from AT&T (U.S. , iphone data plan) after I initiate the GPRS section. But cannot open the socket.

    Is it something that I am doing that is not making it go thru? or somethign else?

  8. Daniel Says:

    Hi, I’m too experiencing some weird problems with the GM862. I’m trying to send HTTP POST packets to a remote server and sometimes the connection seems to freeze after receiving “CONNECT” from the server. I thought that, once connected, we could be almost sure about the correct transmission of the packets but this doesn’t seem to be the case…

    This problem seems to appear only when I power/unpower the modem for each transmission (batery-based app). However, if I leave the modem ALWAYS ON, then the problem only occurs (sometimes) for the first transmissions. The rest of (periodic) transmissions are run without problems. Another remark is that reducing the delay between the power-on action and the http transmission increases the risk freezing on the “CONNECT” state.

    At this stage, I wander if I could maybe abandon the HTTP post method and go for simpler GPRS comm methods… UDP maybe…

    Thanks guys for your comments,

    Daniel.

    • Shahram Javey Says:

      Hi Daniel, have you tried looking at the Python code that comes with Telit. It may shed light on how to organize the AT commands to get HTTP to work. I’ve not, but I do know that Telit has a good Python module to make this work. I have not worked on GPRS much. I got FTP to work and it worked reasonably well using the Easy GPRS commands. But for now, all I’m using is SMS. Good luck.

      • Daniel Says:

        Thanks Shalram.

        I’ve not looked at the Pyton code but I will. I’ve been following the AT commands guide from Telit. The main diference with regards to general applications is that my application is switching ON the modem before each transmission and then OFF. FOr always ON apps, everything seems to work just fine.

    • Shahram Javey Says:

      How quickly after the Telit restart do you attempt to create a GPRS session? In my case (which is also battery operated). I wait for 30 secs. for everything to settle down before attempting to use Telit.

      • Daniel Says:

        I’ve tried with different timeouts (30 sec, 1 min, …). I agree in that higher timeouts help reducing the risk of error but, in my case, this does not completely solve the problem.

  9. Daniel Says:

    Just a last question:

    How can I exit from the freezed “CONNECT” state? Any AT commadn that I could run prior to try again?

    Thanks again,

    Daniel.

  10. ruZZ.il Says:

    In the same boat as you guys. My GM862-GPS doesn’t respond after trying to open a socket to a web server.. yet. sending +++ doesnt even work but it usually times out. I’ve already got my web server waiting!
    I’ve even used this:
    http://code.google.com/apis/kml/articles/phpmysqlkml.html
    to make this (kml file)
    http://ru55.com/gprsms/test2.php
    after I set up dynamic url to update a mysql table..
    which can automatically get refreshed in google earth. just neeeed to use GET… need to use GET.. need to use GET…..

    Meanwhile, SMS and e-mail are easy.

  11. Daniel Says:

    I solved the problem just using a new GM862 modem. It seems that I was using a very old version and old GM862 modems had some issues with TCP conenctions… Is this your case?

  12. ruZZ.il Says:

    I live in Israel and have a contact at telit. I will go there soon and find out (need to pick up another module soon anyway). Hopefully around the end of next week.

  13. ruZZ.il Says:

    AT&K=0

    TURN HARDWARE FLOW CONTROL OFF

    :D

    Thanks to a post from kobuseng on http://www.microchip.com/forums/tm.aspx?m=418115&mpage=1&key=&#456199

  14. chiru Says:

    Hi,
    I I have a problem with GM862-GPS while testing the GPRS AT commands.
    I am originated in india and i use the local GPRS service provider(AIRTEL).But the command AT#GPRS=1 shows error.Can any one say why this is not working?I used the same SIM in the hand set and i am able to browse the internet.

  15. ruZZ.il Says:

    firsty, you need to initialize the GPRS settings:
    (AT+CGDCONT=…). You will need to find out the APN(Access Point Name) that your service provider uses for GPRS (UINTERNET for my service provider, as you’ll see below. you may have to call your provider and ask). Furthermore, AT+GPRS=1 will give you an error if you’ve already initialized GPRS, in which case the sequence AT+GPRS=1, AT+GPRS=0, AT+GPRS=1 is used if you really want to verify connection. a typical sequence for me looks like this:
    read line: ATT
    read line: OK
    read line: at+cmgf=1
    read line: OK
    read line: AT+CNMI=3,1
    read line: OK
    read line: ATS12=20
    read line: OK
    read line: ate1
    read line: OK
    read line: AT+CREG=1
    read line: OK
    read line: AT&K=0
    read line: OK
    read line: AT#NITZ=1,1
    read line: OK
    read line: at#scfg=1,1,400,50,100,5
    read line: OK
    read line: AT+CGDCONT=1,”IP”,”UINTERNET”,”0.0.0.0″,0,0
    read line: OK
    DONESETUP:
    read line: AT#gprs=1
    read line: +IP: 10.195.171.8
    next…read line: OK
    read line: AT#SD=1,0,(my servers port),”(my servers address)”,0,0,0
    read line: CONNECT
    read line: hello
    … naturally, there is quiet some initialisation up there that you may not need…
    hope some of this helps.

  16. terry Says:

    AT&K=0
    worked for me!!!!

    thank you for posting, I was about to cut off my pinky toe.

Leave a Reply