Difference between revisions of "GSM/GPRS"

From ArmadeusWiki
Jump to: navigation, search
(APF51Dev)
(APF51Dev)
Line 61: Line 61:
 
</pre>
 
</pre>
 
* Configure serial port:
 
* Configure serial port:
If the /dev/ttyS0 file doesn't exists, create it with command :
+
If the /dev/ttyS[0-1] files don't exist, create it/thel with ''mknod'' :
 
<pre class="apf">
 
<pre class="apf">
 
# mknod /dev/ttyS0 c 4 64
 
# mknod /dev/ttyS0 c 4 64
 +
# mknod /dev/ttyS1 c 4 65
 
</pre>
 
</pre>
 
Then :
 
Then :

Revision as of 14:32, 28 June 2011

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

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 on your APF51Dev (near microSD connector) AND power on FPGA Bank 1 (with corresponding jumper).
  • 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 board_irq_mng
# modprobe 16750_ocore
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
  • 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

$ 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


# 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/
# 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

#cat > /etc/ppp/options.ttyS0 <<EOF
115200
EOF
  • Launch the beast:
# pppd /dev/ttyS0 115200 call bouygtel
  • Might be needed afterwards:
# cp /etc/ppp/resolv.conf /etc/resolv.conf
# route add default ppp0     (due to defaultroute option in ppp ?)

Test

# ping www.google.fr

Links