Difference between revisions of "GSM/GPRS"

From ArmadeusWiki
Jump to: navigation, search
(PPP configuration)
(PPP configuration)
Line 201: Line 201:
 
{{Note|Following instructions are given for the French operator "Bouygtel" and may need to be ajusted accordingly, depending on your operator/country}}
 
{{Note|Following instructions are given for the French operator "Bouygtel" and may need to be ajusted accordingly, depending on your operator/country}}
  
For '''APF51'''
+
* Create a "chat" script that will be used to initiate MODEM dialup (here we use the "cat > xxxx << EOF trick" to automatically create the file, but you can also manually edit it with ''vi'' or ''nano''):
 
<pre class="apf">
 
<pre class="apf">
# mkdir -p /etc/ppp/peers/
 
# cat > /etc/ppp/peers/bouygtel <<EOF
 
noauth
 
#connect "/usr/sbin/chat -v -f /etc/chatscripts/bouygtel"
 
debug
 
ttyS0
 
defaultroute
 
noipdefault
 
usepeerdns
 
EOF
 
 
 
 
# mkdir -p /etc/chatscripts/
 
# mkdir -p /etc/chatscripts/
 
# cat > /etc/chatscripts/bouygtel <<EOF
 
# cat > /etc/chatscripts/bouygtel <<EOF
ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE' ABORT 'NO ANSWER' ABORT DELAYED
+
ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE' ABORT 'NO ANSWER' ABORT DELAYED ABORT ERROR
 +
'' AT
 
OK ATE1
 
OK ATE1
OK AT+CPIN=0000
+
OK AT+CPIN="0000"
 
OK-AT-OK AT+CFUN=1
 
OK-AT-OK AT+CFUN=1
 
OK AT+COPS?
 
OK AT+COPS?
Line 227: Line 216:
 
OK-AT-OK 'ATD*99#'
 
OK-AT-OK 'ATD*99#'
 
CONNECT ""
 
CONNECT ""
 +
EOF
 +
</pre>
 +
* Don't forget to update "AT+CPIN=" with your real PIN code and "AT+CGDCONT" and "ATD*99#" with your operator parameters.
 +
 +
====For '''APF51'''====
 +
* create the PPPd config files (''/etc/ppp/peers/bouygtel'' and ''/etc/ppp/options.ttyS0''):
 +
<pre class="apf">
 +
# mkdir -p /etc/ppp/peers/
 +
# cat > /etc/ppp/peers/bouygtel <<EOF
 +
noauth
 +
#connect "/usr/sbin/chat -v -f /etc/chatscripts/bouygtel"
 +
debug
 +
ttyS0
 +
defaultroute
 +
noipdefault
 +
usepeerdns
 
EOF
 
EOF
  
Line 234: Line 239:
 
</pre>
 
</pre>
  
For '''APF27'''.
+
====For '''APF27'''====
 
{{Note| Check if /dev/ttySMX1 exists, if not create it with :
 
{{Note| Check if /dev/ttySMX1 exists, if not create it with :
 
<pre class="apf">
 
<pre class="apf">
Line 240: Line 245:
 
</pre>
 
</pre>
 
}}
 
}}
 +
* create the PPPd config files (''/etc/ppp/peers/bouygtel'' and ''/etc/ppp/options.ttySMX1''):
 
<pre class="apf">
 
<pre class="apf">
 
# mkdir -p /etc/ppp/peers/
 
# mkdir -p /etc/ppp/peers/
Line 250: Line 256:
 
noipdefault
 
noipdefault
 
usepeerdns
 
usepeerdns
EOF
 
 
 
# mkdir -p /etc/chatscripts/
 
# cat > /etc/chatscripts/bouygtel <<EOF
 
ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE' ABORT 'NO ANSWER' ABORT DELAYED
 
OK ATE1
 
OK AT+CPIN=0000
 
OK-AT-OK AT+CFUN=1
 
OK AT+COPS?
 
OK AT+CSQ
 
OK-AT-OK 'AT+CGDCONT=1,"IP","ebouygtel.com","",0,0'
 
OK-AT-OK 'AT&FE0Q0V1'
 
OK-AT-OK 'ATD*99#'
 
CONNECT ""
 
 
EOF
 
EOF
  

Revision as of 18:55, 23 January 2012

This page will summarize informations to use the GSM/GPRS/3G module of the APF27Wireless board and the APF51Dev (optional).

Introduction

GSM/GPRS are generally driven through the RS-232 bus. AT commands are used to dialog with the module.

  • GSM MODEM of the APF27Wireless extension board (APW) is connected to the UART2 (/dev/ttySMX1) of the APF27.
  • GSM/3G MODEM of the APF51Dev is connected to the i.MX processor through an UART implemented in the FPGA. So the corresponding bitfile has to loaded before trying to access the MODEM.

Both are using a Sagem's Hilo module. Hilo AT commands can be found here

Linux configuration (APF27Dev only)

  • Linux will have to be configured in order to tell that an APW is connected to your APF27Dev:
$ make linux26-menuconfig
System Type  --->
    Freescale MXC Implementations  --->
            ...
            Extension board (Wireless (APW))  --->
       [*] GSM/GPRS Modem (NEW)
       [ ] Bluetooth & WiFi module (NEW)
       [ ] CSI (Camera) pass-through (NEW)
       [ ] GPS module (NEW)
$ make linux26
  • reflash you Linux kernel

Usage

Configure serial port

APF27

# export GSM_PORT=/dev/ttySMX1              (or /dev/ttymxc1 on recent kernels)
# stty -F $GSM_PORT raw -echo -echoe -echok 115200

APF51Dev

  • Don't forget to put "Wireless" jumper J42 on your APF51Dev (near microSD connector) AND power on FPGA Bank 3 (with corresponding jumper J39).
  • On APF51Dev, GSM/3G module is accessed through serial ports synthetized in APF51's FPGA. So we have to load it first. (Needed dual UARTs FPGA firmware can be found under armadeus-4.0 distribution in firmware/pod_scripts directory, with the POD script needed to regenerate it, and is by default installed in rootfs).
# load_fpga /lib/firmware/fpga/apf51_gsm_gps_firmware.bin

Once firmware loaded, drivers related to FPGA can be used :

# modprobe irq_ocore
# modprobe 8250
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
# modprobe twin_uarts_irq_mng
# modprobe twin_uarts_16750
serial8250.0: ttyS0 at MMIO 0xb8000020 (irq = 320) is a TI16750
serial8250.0: ttyS1 at MMIO 0xb8000040 (irq = 321) is a TI16750

Bring MODEM out of reset state (POK_IN/PWON pin, connected to PMIC GPIO6):

# modprobe wm831x-gpio
# echo 245 > /sys/class/gpio/export
# echo out > /sys/class/gpio/gpio245/direction
# echo 1 > /sys/class/gpio/gpio245/value
  • Configure serial port:

If the /dev/ttyS[0-1] files don't exist, create it/thel with mknod :

# mknod /dev/ttyS0 c 4 64
# mknod /dev/ttyS1 c 4 65

Then :

# export GSM_PORT=/dev/ttyS0
# stty -F $GSM_PORT raw -echo -echoe -echok 115200

AT commands

# cu -l $GSM_PORT

( To exit cu you will have to type ~. )

  • Check module presence:
ATI3
SAGEM HiC,A.005.00

OK
Note Note: By default, for Hilo v2 module, no echo are printed on serial console. Then you can't see what you type.

To reactivate the echo type

ATE1
  • Get constructor name:
AT+CGMI
SAGEM

OK
  • Get model name:
AT+CGMM
HILO GPRS

OK
  • Enter PIN code (here 0000). !! Use your own and beware that you will only get 3 tries !!:
AT+CPIN="0000"

OK
  • Check PIN code status:
AT+CPIN?
+CPIN: READY

OK
Note Note: Don't launch further AT commands if PIN code wasn't entered successfully


  • Check module status (0 Ready, 1 Unavailable, 2 Status unknown, 3 Ringing, 4 Call in progress, 5 Asleep):
AT+CPAS
+CPAS: 0

OK
  • Get Indicator control (<battchg>[0-4],<signal>[0-4],<service>0/1,<message>0/1,<call>0/1,<smsfull>0/1):
AT+CIND?
+CIND: 0,4,1,0,0,0,1

OK
  • Get signal quality (should be better than 12/99):
AT+CSQ
+CSQ: 24,99

OK
  • Voice call "123456789" (; is important here to signify a voice call, otherwise a data call is tried and may fail if you don't have the right subscribe)
ATD"123456789";
OK
  • Terminate current call:
ATH
OK

Tools to look at

Data tranfers (EDGE/3G)

PPP installation (Done by default on APF51)

$ make linux26-menuconfig
Device Drivers  --->
    [*] Network device support  --->
        <M>   PPP (point-to-point protocol) support
        [ ]     PPP multilink support (EXPERIMENTAL)
        [ ]     PPP filtering
        <M>     PPP support for async serial ports
        < >     PPP support for sync tty ports
        < >     PPP Deflate compression
        < >     PPP BSD-Compress compression
        < >     PPP MPPE compression (encryption) (EXPERIMENTAL)
        < >     PPP over Ethernet (EXPERIMENTAL)
$ make menuconfig
Package Selection for the target  --->
    Networking applications  --->
        [*] pppd
        [ ]   filtering
        [ ]   radius
$ make linux26 && make
  • reflash kernel & rootfs

PPP configuration

Note Note: Following instructions are given for the French operator "Bouygtel" and may need to be ajusted accordingly, depending on your operator/country


  • Create a "chat" script that will be used to initiate MODEM dialup (here we use the "cat > xxxx << EOF trick" to automatically create the file, but you can also manually edit it with vi or nano):
# mkdir -p /etc/chatscripts/
# cat > /etc/chatscripts/bouygtel <<EOF
ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE' ABORT 'NO ANSWER' ABORT DELAYED ABORT ERROR
'' AT
OK ATE1
OK AT+CPIN="0000"
OK-AT-OK AT+CFUN=1
OK AT+COPS?
OK AT+CSQ
OK-AT-OK 'AT+CGDCONT=1,"IP","ebouygtel.com","",0,0'
OK-AT-OK 'AT&FE0Q0V1'
OK-AT-OK 'ATD*99#'
CONNECT ""
EOF
  • Don't forget to update "AT+CPIN=" with your real PIN code and "AT+CGDCONT" and "ATD*99#" with your operator parameters.

For APF51

  • create the PPPd config files (/etc/ppp/peers/bouygtel and /etc/ppp/options.ttyS0):
# mkdir -p /etc/ppp/peers/
# cat > /etc/ppp/peers/bouygtel <<EOF
noauth
#connect "/usr/sbin/chat -v -f /etc/chatscripts/bouygtel"
debug
ttyS0
defaultroute
noipdefault
usepeerdns
EOF

# cat > /etc/ppp/options.ttyS0 <<EOF
115200
EOF

For APF27

Note Note: Check if /dev/ttySMX1 exists, if not create it with :
mknod /dev/ttySMX1 c 204 42
  • create the PPPd config files (/etc/ppp/peers/bouygtel and /etc/ppp/options.ttySMX1):
# mkdir -p /etc/ppp/peers/
# cat > /etc/ppp/peers/bouygtel <<EOF
noauth
#connect "/usr/sbin/chat -v -f /etc/chatscripts/bouygtel"
debug
ttySMX1
defaultroute
noipdefault
usepeerdns
EOF

# cat > /etc/ppp/options.ttySMX1 <<EOF
115200
EOF

PPP Usage

  • Load PPP module:
# modprobe ppp
  • Setup serial port name depending on your platform (/dev/ttyS0 on APF51, /dev/ttySMX1 on APF27)
# export GSM_DEVICE=/dev/ttyS0
  • Launch the beast:
# pppd $GSM_DEVICE 115200 call bouygtel
  • Might be needed after a successful IP setup:
# cp /etc/ppp/resolv.conf /etc/resolv.conf
# route add default ppp0     (due to defaultroute option in ppp ?)

Test

# ping www.google.fr

Links