Connect a GPRS modem to Intel Edison Board

Updated on 30-Jul-2015

This article tries to explain how to establish a data network (using ppp) by connecting a GPRS shield to the Intel® Edison board. An active T-Mobile SIM is being used in the shield.

Enable PPP in Kernel

Enable PPP in the Kernel and install ppp related packages.
Download the source files from http://downloadmirror.intel.com/24698/eng/edison-src-ww05-15.tgz
Before compiling the source files, it is recommended to increase root file system size.
Reference: https://communities.intel.com/docs/DOC-23449
 
Depending on the system configuration build takes 2-6 hours to finish.
** Ubuntu 12.04 has been used
Error while compilation:
1 Install libtool using sudo apt-get install libtool.

1. ERROR: Task 535 (/home/inteldell/edison-src/device-software/meta-edison-distro/recipes-connectivity/libwebsockets/libwebsockets_1.23.bb, do_compile) failed with exit code '1'  

2. NOTE: Tasks Summary: Attempted 1855 tasks of which 18 didn't need to be rerun and 1 failed.  
Fix: Replace the line 22 in the recipe file at
edison-src/device-software/meta-edison-distro/recipes-connectivity/libwebsockets/libwebsockets_1.23.bb
 
Original: export OPENSSL_CONF=${TMPDIR}/sysroots/x86_64-linux/usr/lib/ssl/openssl.cnf
Replace: export OPENSSL_CONF=${TMPDIR}/sysroots/i686-linux/usr/lib/ssl/openssl.cnf
 
Configuring PPP in the Kernel.
1 # bitbake virtual/kernel –c menuconfig

(First I enabled only PPP support for async serial ports,  resulted in another error – enable PPP filtering. So ended up enabling all.)
Now install PPP packages from http://repo.opkg.net/edison/repo/core2-32/
Using pppd, create data connection using GPRS shield.
 After the successful installation you should see the following file structure.

In order to communicate with modem, the hardware serial port on GPIOs 0 and 1 has to be enabled.

Enable Serial Port:
 
Enable the serial port on pins 0 and 1 by executing the following commands on terminal.
 
01 echo 214 > /sys/class/gpio/export 2>&1

02 echo high > /sys/class/gpio/gpio214/direction

03 echo low > /sys/class/gpio/gpio214/direction

04 echo 131 > /sys/class/gpio/export 2>&1

05 echo mode1 > /sys/kernel/debug/gpio_debug/gpio131/current_pinmux

06 echo 249 > /sys/class/gpio/export 2>&1

07 echo high > /sys/class/gpio/gpio249/direction

08 echo 1 > /sys/class/gpio/gpio249/value

09 echo 217 > /sys/class/gpio/export 2>&1

10 echo high > /sys/class/gpio/gpio217/direction

11 echo 1 > /sys/class/gpio/gpio217/value

12 echo out > /sys/class/gpio/gpio131/direction

13 echo 0 > /sys/class/gpio/gpio131/value

14 echo 130 > /sys/class/gpio/export 2>&1

15 echo mode1 > /sys/kernel/debug/gpio_debug/gpio130/current_pinmux

16 echo 248 > /sys/class/gpio/export 2>&1

17 echo low > /sys/class/gpio/gpio248/direction

18 echo 0 > /sys/class/gpio/gpio248/value

19 echo 216 > /sys/class/gpio/export 2>&1

20 echo in > /sys/class/gpio/gpio216/direction

21 echo in > /sys/class/gpio/gpio130/direction

22 echo high > /sys/class/gpio/gpio214/direction

Test the GPRS Shield:
 
Test the status of the GPRS modem by send AT commands using the microcom.

1 # microcom /dev/ttyMFD1 –s 115200

2 AT

3 OK

4 AT+CMGF=1                      Set SMS text format

5 OK                                        

6 AT+CMGS="+1503*****79"       Send SMS message

7 > Hello World

8 +CMGS: 14

9 OK

The same can be implemented using standard serial port programming or by using mraa library.
 
Enable GPRS

1 AT+CGATT=1                                     attach to GPRS network (normally includes in atd*99#)

2 AT+CGATT?                                        should return +CGATT: 1

3 AT+CGDCONT=1,"IP","epc.tmobile.com"             context definition (for T-Mobile)

4 AT+CGACT=1                                     PDP context activation

5 AT+CGDATA="PPP",1                    enter data mode

Connect to internet using GPRS:
 
Create a script that defines PDP (Packet Data Protocol) context and says connected. Please find the attached zip file for scripts.
 
Now establish the connection using command
1 # pppd call gprs &

You can check the log file using
01 #cat /var/log/ppp/log

02
 

03 Press CTRL-C to close the connection at any stage!

04 defining PDP context…

05 AT

06 OK

07 ATH

08 OK

09 ATE1

10 OK

11 AT+CGDCONT=1,"IP","epc.tmobile.com","",0,0

12 OK

13 waiting for connect…

14
 

15 ATD*99#

16 CONNECT

17 Connected.

18
 

19 Serial connection established.

20 Using interface ppp0

21 Connect: ppp0 <–> /dev/ttyMFD1

22 not replacing default route to wlan0 [192.168.1.1]

23 local  IP address 100.198.64.64

24 remote IP address 192.200.1.21

25 primary   DNS address 10.177.0.34

26 secondary DNS address 10.168.185.116

For more such intel IoT resources and tools from Intel, please visit the Intel® Developer Zone

Source: https://software.intel.com/en-us/articles/connect-a-gprs-modem-to-intel-edison

Connect On :