Opening a GPRS request with AT commands

Aus DL8RDS Wiki
Wechseln zu: Navigation, Suche

GSM modules which are capable of handling GPRS traffic are really interesting. My Telit GE863-QUAD is such a nice funny interesting device. I tried out how to access web or other content directly over a serial connection.

Here is how it works:

The GSM modem is actually a normal modem as you may know it from earlier days where DSL was still not known and serial dialin connection were standard. You access such a modem through a serial connection which is either available through a real pair of tty lines or through a USB2Serial (FTDI) chip or somehow else. My SonyEriccson cellphone also creates a serial device in the operating system when I attach a cable to it and hook it up in the USB port. The cellphone creates a device called /dev/ttyACM0 whereas for example the arduino / GSM Playground creates a normal /dev/ttyUSB0.

Now let's open the device with a terminal program. Don't worry, these programs are freely available under Linux. Windows programs may be a little harder to get, but here's my hint: A decently modern putty which is otherwise known as a SSH client, is also capable of servicing the serial port. As serial speed enter 115200 bit/s. Line properties are 8N1.

You may need to wait a few seconds after powering up the GSM modem, But eventually you will be able to enter the command AT, which will make the modem respond with OK. If you get that far, congratulations, you're in.

Now it's time to consult the AT command reference. For the GE863 you can find the command reference here: http://www.telit.com/module/infopool/download.php?id=542 For other GSM modules you shall find the according reference books on the web. Now it's time to try out some things.

First of all you must know that some SIM cards do require the entry of a PIN and some others don't. The German UMTS provider FONIC has SIM cards that don't need any interaction. Remember, those cards are usually in a UMTS USB stick and those sticks don't have a keyboard anyway. And sometimes the user should not really need to interact with it, so those cards are open anyway. Other prepaid network providers such as blue.de or Nettokom require the entry of a pin. But it's rather simple to enter it, now that you're talking to the modem.

AT+CPIN=1234

will do the trick. You can have a look if the login was successful by entering

AT+CPIN?

If it says "READY", you're fine. Then check if you've got a good signal quality:

AT#MONI

Bad signal quality will reduce your speed tremendously. But that should be clear anyway.

AT#GPRS=1

The above command will trigger your provider to initialize the network layer by assigning an IP address to your modem. This is layer 3 in the ISO/OSI model. From now on you're in the internet. It is as simple as this. As a next step you can already try to start a network connection. Since I wanted to control the other end also, I decided to start a netcat tcp client on one of my servers on port 3000:

netcat -l -p 3000

And in the terminal console I entered the command to set up a tcp connection to that machine on port 3000:

AT#SKTD=0,3000,<the IP address of my server>,0,0

And there the connection was! Keep in mind that in order not to disturb the integrity of the data, the echoing will be switched off from now on. Whatever you enter with the keyboard will not come up again on the screen, but it still arrive on the other end.

Remember that the provider will normally not assign a "real" IP address to your client, but one from the subnet 10.0.0.0/8 which is not routed and not accessible from the internet. So it's not possible to contact your GSM module from outside due to provider constraints. Theoretically it's possible, but really only in theory.