How to go to Internet through GPRS setup

From IGEP - ISEE Wiki

Jump to: navigation, search

Overview

This article explains how to set up the modem available on some IGEP expansion boards using pppd.

Prerequisites and tested hardware

Software:

Hardware:

Following explanation was tested with this hardware but should work with other hardware that comes with a GPRS modem (like the IGEPv2 EXPANSION)

Configuration example using Movistar provider (Spain)

The firs thing you'll is create a new directory called chatscripts in /etc/ppp, manually create it to place some new files there. You'll have now to create a file to put your apn information, in that case the

/etc/ppp/chatscripts/apn.es.movistar file should look like this:

AT+CGDCONT=1,"IP","movistar.es"

Of course you can create your own apn file replacing "movistar.es" by your own APN string on them.

After that you can create a symlink called apn that points to your APN file.

ln -snf apn.es.movistar apn

Next, you should create two new files, the

/etc/ppp/chatscripts/pin.CODE file should look like this:

AT+CPIN=<your pin number>

and the

/etc/ppp/chatscripts/pin.NONE file should look like this:

AT

If your SIM card has the PIN code disabled, you should symlink pin to pin.NONE to avoid sending it, otherwise, if the SIM card has the PIN code enabled you should symlink pin to pin.CODE.

ln -snf pin.NONE pin

After that create the core script which dialogues with the modem and properly inserts another above scripts for selecting the APN and the PIN code. As example, the

/etc/ppp/chatscripts/movistar file should look like this:

ABORT 'BUSY'
ABORT 'NO CARRIER'
ABORT 'VOICE'
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT 'DELAYED'
REPORT CONNECT
TIMEOUT 6
'' 'ATQ0'
'OK-AT-OK' 'ATZ'
TIMEOUT 3
'OK' @/etc/ppp/chatscripts/pin
'OK\d-AT-OK' 'ATI'
'OK' 'ATZ'
'OK' 'AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0'
'OK' 'AT+IFC=0,0'
'OK' 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
'OK-AT-OK' @/etc/ppp/chatscripts/apn
'OK' 'ATD*99***1#'
TIMEOUT 30
CONNECT ''

Many ISP require some time of authentication, in that case we should use PAP authentication method creating the new file

/etc/ppp/pap-secrets file should look like this:

# Secrets for authentication using PAP
# client	server	secret			IP addresses
movistar	*	movistar		*

Finally, we should create the provider file that is treated calling the pppd command, the file

/etc/ppp/peers/movistar file should look like this:

noauth
hide-password
/dev/ttyO1
115200
nocrtscts
defaultroute
noipdefault
user movistar
usepeerdns
nodeflate
novj
noccp
persist
connect "/usr/sbin/chat -v -f /etc/ppp/chatscripts/movistar"
ipcp-accept-local
ipcp-accept-remote
lcp-echo-failure 8
lcp-echo-interval 3

At this point we can start manually the pppd connection. First we need to turn on the modem with:

echo 0 > /sys/class/gpio/gpio145/value
echo 1 > /sys/class/gpio/gpio163/value
sleep 1
echo 0 > /sys/class/gpio/gpio163/value

then, we can connect to the ISP with

pppd call movistar

With default firmware in your board you can automate and start the pppd connect to call your provider creating a small script, the

/etc/ppp/ppp_on_boot file should look like this:

#!/bin/sh
# Start modem for IGEP BERLIN (BASE0010)
echo 0 > /sys/class/gpio/gpio145/value
echo 1 > /sys/class/gpio/gpio163/value
sleep 1
echo 0 > /sys/class/gpio/gpio163/value
# Call ppp provider
pppd call movistar

When the system starts, the /etc/init.d/pppd check if /etc/ppp/ppp_on_boot exists and in that case runs this file. The script just turn on the modem and calls pppd to connect to movistar.

Troubleshooting

Debug information can found in

tail -f /var/log/messages