SparkFun Forums 

Where electronics enthusiasts find answers.

Tips and questions relating to the GPS modules from SFE
By Armchair Ninja
#64106
I'm working on a project that requires a cellular data connection. I have an x86 PC running Ubuntu Linux (8.10) connected serially to the GM862 on a SparkFun Uberboard. In the slot of the GM862 is a AT&T SIM with an unlimited data plan (U.S.A. network).

Using AT commands to the modem, I can get the modem to register with AT&T's 3G network and dial in to AT&T's GPRS service, but I have not been able to make an IP connection. There's obviously some kind of authentication/login step that needs to happen, but I don't know how to initiate it.

Has anyone done this, or have a script for accessing AT&T's GPRS service?

Thanks in advance...
By TomasTrek
#64132
It could be that the APN you are connecting to doesnt give you direct internet access. I had that problem with o2 and for a while on Vodafone. Im in a different country to you so it could be a different problem entirely. Contact your service provider for the correct settings, but also dont rely on them as the settings o2 told me numerous times was definitely guaranteed to work.. didnt. I had to look online for APN settings and eventually came by some which worked.

Also make sure you are escaping correctly if you are doing this in code. You should get a username and password from the APN settings, and you can use them like this:
Code: Select all
MDM.send('AT+CGDCONT=1,"IP","internet"\r',0)
r = MDM.receive(100)

MDM.send('AT#USERID=web\r',0)
r = MDM.receive(100)

MDM.send('AT#PASSW=web\r',0)
r = MDM.receive(100)

MDM.send('AT#GPRS=1\r',0)
r = MDM.receive(100)
Of course web as a username and password wont be correct for you, they are the settings for Vodafone. You can check the values of r to verify if it worked or not.

If it did you can get the web page by doing:
Code: Select all
MDM.send('AT#GPRS=1\r',0)
MOD.sleep(80)
MDM.receive(500)

MDM.send('AT#SKTD=0,80,"google.com"\r',0)
r = MDM.receive(100)
#check here if r contains 'CONNECT'

MDM.send('GET / HTTP/1.0\r\nConnection: close\r\n\r\n',0)
r = MDM.receive(900)
MDM.send('+++',0)
At the end, r is equal to the html of the web page. In reality it may be a little more complicated, for example after sending the escape sequence, I still had to sleep for 50ms and then read for 200ms before the data actually came through. The escape sequence "+++" must be used at the end otherwise you wont be able to access the result. Thats what I have found in my tests, there may be a way but you should escape anyway. Also after all this is done you probably want to deregister from the GPRS service (send AT+GPRS=0) because after some time, your ip address will probably expire and then you will have some trouble (as I found out - Vodafone IP addresses expire after 48 hours). You will be assigned a new IP address next time you do AT+GPRS=1
By rstanchak
#64512
I successfully connect using Wvdial under Linux with the following init commands:
Code: Select all
ATZ
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
AT#BND=1
AT+cgdcont=1,,"WAP.CINGULAR"
The stumbling point for me was a missing AT#BND=1 command, which sets the module for North American frequencies. BTW, thanks to lenwerks for this tip in another thread:

viewtopic.php?t=12863&sid=9a724dcd302b1 ... 8dadbf903a

FWIW, my entire wvdial.conf is below:
Code: Select all
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT#BND=1
Init4 = AT+cgdcont=1,,"WAP.CINGULAR"
Password = CINGULAR1
Phone = *99***1#
Modem Type = Analog Modem
Baud = 230400
New PPPD = yes
Modem = /dev/ttyUSB1
ISDN = 0
Username = WAP@CINGULARGPRS.COM
Carrier Check = no
By Armchair Ninja
#64526
Thanks for the replies!

Most of your script, rstanchak, looks the same as the commands that I'm using. For Init4, I have to include "IP" as the second argument or I get an error, and the modem I am using is on /dev/ttyS0. I had not been using wvDial, so I gave that a try. I get the following output:
Code: Select all
CONNECT
--> Carrier detected.  Waiting for promt.
--> Don't know what to do!  Starting pppd and hoping for the best.
--> Starting pppd at <date & time>
--> Pid of pppd: <process ID>
...at which point it sits there forever. After escaping, I can no longer communicate with the modem, and have to reset it manually.