Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
GSM/3G/4G in
Embedded Linux
Systems
Introduction
CHAIRMAN
May16 |
CHAIRMAN
www.toradex.com
May16 |
Hardware Specification
CHAIRMAN
In this article we will be using the Colibri iMX6S with the base
board called Colibri Evaluation Board, both of which, are from
Toradex. The Colibri Evaluation Board is recommended
specifically for project evaluation and development. This product
comes with a great number of interfaces like USB, Ethernet, I2C,
SPI, RS242, RS485, CAN and many others. We can also find some
multimedia interfaces like HDMI, LVDS, VGA and LCD already
supported on the Evaluation Board.
To follow this tutorial, you can use any USB or Serial modem to
connect to the internet.
www.toradex.com
May16 |
You just have to adapt the interface created at /dev/ and check
the AT commands supported and implemented for your
modem
CHAIRMAN
because each modem has specific AT commands. In this case, we
have used for this tutorial a Huawei E173s 3G modem with a
compatible SIM Card with data plan activated.
Kernel Preparing
To use the 3G USB modem through the PPP protocol, it is
necessary to select some features in the kernel configurations and
then compile the Kernel. To understand how to compile the kernel,
I suggest following the link below.
http://developer.toradex.com/software-resources/arm-family/linux/
www.toradex.com
May16 |
CHAIRMAN
Toolchain configuration
Compile
www.toradex.com
May16 |
CONFIG_PPP:
PPP (Point to Point Protocol) is a newer and better SLIP. It
serves the same purpose: sending Internet traffic over
telephone (and other serial) lines. Ask your access provider if
they support it, because otherwise you can't use it; most
Internet access providers these days support PPP rather than
SLIP.
Device Drivers --->
[*] Network device support --->
PPP (point-to-point protocol) support
PPP BSD-Compress compression
PPP Deflate compression
www.toradex.com
May16 |
[*]
PPP filtering
PPP MPPE compression (encryption)
[*]
PPP multilink support
PPP over Ethernet
PPP support for async serial ports
PPP support for sync tty ports
CHAIRMAN
CONFIG_USB_ACM:
This driver supports USB modems and ISDN adapters which support
the
Communication Device Class Abstract Control Model interface.
Please read <file:Documentation/usb/acm.txt> for details.
Device Drivers --->
[*] USB support --->
USB Modem (CDC ACM) support
www.toradex.com
May16 |
May16 |
www.toradex.com
May16 | 10
www.toradex.com
May16 | 11
mtu 296
lcp-echo-interval 30
lcp-echo-failure 4
noipx
persist
asyncmap 0xa0000
mru 1500
refuse-chap
ipcp-max-failure 30
logfile /home/root/ppp
CHAIRMAN
www.toradex.com
May16 | 12
The next step is to create one more file inside /etc/ppp/peer In this file we
have configurations for our network provider and the path for the chat
CHAIRMAN
file:
www.toradex.com
May16 | 13
Now we create the file responsible for sending the AT commands to the
modem so it can connect to the internet. This file varies according to
CHAIRMAN
modem models/brands.
www.toradex.com
May16 | 14
May16 | 15
May16 | 16
May16 | 17
sent
rcvd
sent
rcvd
sent
rcvd
sent
rcvd
sent
rcvd
sent
rcvd
sent
rcvd
sent
rcvd
[IPCP
[IPCP
[IPCP
[IPCP
[IPCP
[IPCP
[IPCP
[IPCP
[IPCP
[IPCP
[IPCP
[IPCP
[IPCP
[IPCP
[IPCP
[IPCP
www.toradex.com
ConfReq id=0x3 ]
ConfNak id=0x3 ]
ConfReq id=0x4 ]
ConfNak id=0x4 ]
ConfReq id=0x5 ]
ConfNak id=0x5 ]
ConfReq id=0x6 ]
ConfReq id=0x1]
ConfNak id=0x1 ]
ConfRej id=0x6 ]
ConfReq id=0x7 ]
ConfReq id=0x2 ]
ConfAck id=0x2 ]
ConfNak id=0x7 ]
ConfReq id=0x8 ]
ConfAck id=0x8 ]
Toradex is a registered trademark of Montadex GmbH
CHAIRMAN
May16 | 18
CHAIRMAN
As seen in the log file, the chat script is executed step-by-step until we get
the following:
May16 | 19
CHAIRMAN
www.toradex.com
May16 | 20
To configure DNS, we can use the following command and then ping a
URL, for example:
www.toradex.com
May16 | 21
CHAIRMAN
www.toradex.com
Image 1:
A running
web
browser
using 3G
connectio
n.May16 | 22
We can avoid the file being rewritten when system is restarted with
the following command:
CHAIRMAN
www.toradex.com
May16 | 23
CHAIRMAN
May16 | 24
After the Host name is created we can again connect to the module using
SSH:
CHAIRMAN
www.toradex.com
May16 | 25
CHAIRMAN
May16 | 26
#!/usr/bin/python
CHAIRMAN
import sys
import requests
import netifaces as ni
user = 'xxxxxxx'
pswd = 'xxxxxxx'
ni.ifaddresses('ppp0')
ip = ni.ifaddresses('ppp0')[2][0]['addr']
myhostname = 'toradex.noip.me'
payload = {'hostname' : myhostname , 'myip' : ip}
r = requests.get("http://dynupdate.no-ip.com/nic/update",
params=payload, auth=(user,pswd))
www.toradex.com
May16 | 27
May16 | 28
www.toradex.com
May16 | 29
May16 | 30
CHAIRMAN
Final Thoughts
As seen in this article, a Linux system has many network
functionalities. We just need to properly configure them and have
access to ppp0 network. Another important point, is that regardless of
the used interface, the programming method remains the same. The
task of choosing the interface to use is made automatically by Linux
depending on the routes. For those who require network connection in
their projects and also need system flexibility, the use of Linux in
embedded systems is the way to go.
References
http://metodiew.com/huawei-e173s-and-ubuntu/
http://developer.toradex.com/product-selector/colibri-imx6
http://developer.toradex.com/product-selector/colibri-evaluation-board
www.toradex.com
May16 | 31
Thank
you!
www.toradex.com
May16 | 32