Next Previous Contents

5. Controlling your "modem"

This section will introduce you to the way you should communicate with your modem to get things done. This is mainly done with AT-commands. These commands can be given using a Terminal program (for example minicom or seyon) with the right settings. The serial port can be found in the dmesg output, the serial port settings are usually 115200 bits per second, 8 data bits, No parity and 1 stop bit (115200 8N1).
After this section you will know which commands you need to send to your modem to make the GPRS connection.

5.1 Checking the serial port

To check if you use the correct serial port, enter the command AT and the GPRS device should respond with OK. If this doesn't work, you either have the wrong port, or the wrong settings.

5.2 Entering you PIN Code

If the SIM card in your device is configured to ask for a PIN Code before you can use your device, you must enter it. To check if you need to do this, enter the command AT+CPIN?. If you don't need to enter your PIN Code the result will be +CPIN: READY. Entering the PIN Code is done with the command AT+CPIN=<PIN>, so if your PIN Code is 1234 the command will be AT+CPIN=1234. If your device requires this, make sure to add this command to the init strings of your dialer.

5.3 Controlling your Attach

A GPRS device has to attach itself to the network before it can make use of the services offered via GPRS. Some devices Attach automatically, some don't. To see the status of your Attach, use the command AT+CGATT?. The result will be either +CGATT: 1 if the device is Attached, or +CGATT: 0 if it isn't Attached. If your device didn't Attach automatically, make sure to add the command to the Init strings for your Dialer.
To Attach your device, use the command AT+CGATT=1 and to detach it use AT+CGATT=0. Attaching your device is usually free of charge because it is required for the network to function. If the Attach fails, there might be a few reasons:

When you have an Attach, your device is ready for the next step: Creating a data connection.

5.4 PDP Context Profiles

A PDP Context is the data connection over the GPRS network. You can compare this with actually calling someone, but instead of a person you're calling a network.
Some mobile devices allow multiple PDP Context profiles. Each profile can contain settings for a different network. These settings include (but are not limited to):

Controlling the profiles is done with the AT+CGDCONT command. Use AT+CGDCONT? to list them. Setting it can be done with:
AT+CGDCONT=<Profile Number>,"<PDP Type>","<APN>"
I usually only use profile number 1, which i overwrite with the settings i need. The PDP Type is usually IP, and the APN should be provided by your operator, but internet is usually a good guess if you want to connect to the internet. The complete command will be:
Good practice is to add this command to the init strings of your Dialer.

Here is a list of APN names per provider which will be helpful if you don't know know what to use.

5.5 Actually Dialing

To actually create your PDP Context, you need to use the AT DT command, which was also used in traditional dialing. For GPRS you need to dial a special number: *99***<profile number>#
The profile number should be the same as used in the AT+CGDCONT command. So to start using the connection defined with profile 1, use the command: AT DT *99***1#
When you did this, the device will actually create the PDP Context. If this succeeds, you will see the result CONNECT in your terminal, and after that some "junk", which is actually the device trying to set up a PPP connection with your computer. This is the point where human readable commands stop.
If it doesn't work, there might be a few causes:

Next Previous Contents