Multihoming support for data communication over cellular networks - Embedded.com

Multihoming support for data communication over cellular networks

Increasingly embedded programmers are faced with situations where they need to interface their applications with a commercial wireless communication protocol stack.

Typical application scenarios include a web client running on a handheld device like a mobile phone, a security application sending images from a remote site over the GPRS network or a more specialized tracking application marking the progress of a physical process using short message service (SMS).

In all of these scenarios, the application programmer is mostly relies on simple send/receive type functions to complete the job. However, at the middleware level some configuration/setup changes in software are required before one can use the typical networking APIs.

The procedure, involving wireless modem commands is a simple one and does not merit implementation as a full scale middleware product. Therefore the onus is on the networking programmer to figure out this interfacing mechanism. This paper provides useful information for the embedded developer who wants her embedded application to communicate with the outside world using the widely deployed 2/2.5G cellular network

This article contrasts two cellular networking architectures used in practice, i) the Telephony architecture and ii) the Machine-to-Machine (M2M) architecture [1]. The steps required to setup a data connection are common among these two cases; mainly it requires sending appropriate AT commands [2] to the modem.

However, there are important differences in how the programmer interacts with the wireless protocol stack in these architectures as explained later in this paper.

Second generation cellular systems especially the GSM standard has been a huge commercial success for voice communications around the globe. Although the wireless standard offers limited bandwidth for high speed data applications like live streaming and video conferencing etc. still its wide deployment ensures a competitive market for emerging data centric standards like UMTS and WiMax.

In the meantime, enhancements have been made to the original GSM standard with GPRS and EDGE technologies deployed and tagged as 2.5G communication systems. There are three major components of GSM protocol software stack, i.e. the physical layer, data link layer and signaling layer [3].

In typical GSM/GPRS modems, the physical layer is implemented in a DSP while the other layers are implemented in a RISC architecture processor. There is also a separate hardware RF interface. (See for instance the solution from BroadCom, BCM2124 [4] )

Cellular Data Networking over GPRS Networks
With a GSM/GPRS modem in hand, the embedded programmer needs to understand commonly used terms before being able to setup an internet connection. This includes PDP contexts and multi-homing.

PDP Context . A Packet Data Protocol (PDP) context in GPRS networks is an information structure maintained at the Gateway GPRS Support Node (GGSN). This structure maintains the network addresses and quality of service profile (precedence class, peak throughput, mean throughput and reliability etc) for a logical link between Mobile Station (MS) and Cellular Network. A PDP context is created during session management procedure in GSM networks.

Usually a MS is attached to a Serving GPRS Support Node (SGSN) that acts a base station responsible for mobility management etc. Once an MS wants to transfer data, it must activate a PDP context. Activating a PDP address establishes an association between the mobile's current SGSN and the GGSN that maintains the PDP address.

Primary PDP Context .Any MS can define up to 11 (numbered 1-11) PDP contexts with each having its own IP Address. Multiple PDP contexts can be defined with different Access Points (AP) although multiple contexts with a single AP are also allowed. However, in the later case there will no logical link available between MS and Cellular Network if the Access Point goes down or is unreachable.

Secondary PDP Context .A secondary PDP context is one that shares its IP Address with a primary PDP context. The number of PDP context (any combination of primary and secondary) should remain up to 11. Most modems provide an AT command set that can be used to define and activate primary and secondary PDP contexts

Multi-homing Data Access
Multi-homing is the availability of multiple IP addresses on a single terminal, with the idea of having reliable connectivity. This is quite a useful concept in mobile networks, since wireless channel is a low fidelity medium and error rate is higher compared to wired links such as cable and Ethernet.

The availability of more than one logical link can help to overcome potential packet loss. In the context of cellular modems, multi-homing offers more than just the redundant data connections; it allows maintaining different QOS profiles on multiple logical links i.e. a separate profile for internet browsing and another for multimedia streaming.

For instance an application can choose to send video on a primary PDP context whose QOS profile demands low delays, while selecting a secondary context with less demanding QOS profile to communicate voice. This way both contexts have the same IP address still maintaining two connections of different transmission characteristics.

Embedded Networking Software
Almost every embedded OS has a networking extension, in its minimal form it is just the TCP/IP stack, enabling an embedded system to connect with its peers as well as facilitating its communication with the outside world.

In some other cases it might have enhanced features like security, IPv6 support and support for other routing layer protocols. Most embedded developers are familiar with the BSD socket style functions supplied by networking stack and would prefer to use the same API's even if the low level medium is a wireless link.

Telephony Architecture
In this architecture the wireless protocol stack is housed in a separate power economical baseband processor like the ARM9 based BroadCom Edge Modem [4]. The user application (with UI/Graphics functions) runs on any other processor, and communicates with the modem over a serial interface using modem's AT command set. This setting is shown in Figure 1 below .

Figure 1: Typical Telephony Architecture

For telephony functions normally a layer of multiplexing protocol GSM 07.10 [5] is also implemented on both modem side as well as the application processor to provide virtual channels for data and commands. There is an option for the programmer to disable multiplexer by using the AT+CMUX command but then the data connection and voice/SMS cannot be processed simultaneously.

Machine-To-Machine (M2M) Architecture
In this architecture, user application and the wireless stack reside on the same processor. This is an attractive option as it reduces the overall bill of material, but there are many challenges since the protocol stack periodically performs time-critical tasks and the application must not interfere with its operations.

In order to protect the protocol stack from user level code, an application framework (Figure 2 below has to be provided by the software stack manufacturer. The mode of communication between application and protocol stack is defined by the application framework.

Figure 2: Typical M2M Architecture

Compared to Telephony case where a point to point (serial) interface is employed, in M2M a message passing approach or a client server scheme is used. Normally, a set of API's is provided by the protocol stack that can help the application to send AT commands.

Step By Step Guide to Multi-homing
We use the standard AT command [2] set of GSM/GPRS modules to demonstrate the steps required for supporting multi-homing over a GPRS modem. These steps are listed below in Table 1 below .

Table 1: Multi-Homing Configuration Steps

First, define two primary PDP contexts with the Access Point (AP) name “xyz.com”. This information is available from the GPRS network operator. Now define a third, secondary PDP context, as shown in Table 1.

In step two the contexts are activated, there is no need of separately activating the 3rd (secondary) PDP context since it will be up with the activation of first context.

In the third step check the IP address assignment of the contexts. The two primary PDP contexts should have different IP Addresses while the secondary PDP context will share the IP address with first one.

In the fourth step, Quality of Service (QOS) profiles are defined. For instance, QOS profile for PDP context one is defined with best precedence (range: 0-3, 0 best) least delay (range: 0-4, 0 worst), most reliable (range: 0-5, 0 worst), medium peak throughput (range: 0-9, 0 lowest) and best effort mean throughput (range: 0-18 and 31, 0 lowest 31 best effort).

A secondary PDP context although sharing the same IP Address with a primary context can still has its own QOS profile enabling multi-homing capability.

Example Code
The main difference in wireless programming for Telephony and M2M cases is the treatment of GPRS module as an external modem in Telephony settings. There, a link layer protocol like PPP is mostly used to communicate with the modem.

Once PPP link layer is setup, the application programmer can use networking library functions for sending data over GPRS network. For M2M, GSM link layer is directly used since application is already on the same processor as the protocol stack.

Table 2: Demo M2M Programming For Cellular Data Connectivity

Table 2 above highlights this difference using pseudo-code for M2M case while

has the programming details for the Telephony case.

For demonstration purposes of M2M programming we assume that the protocol stack will expose a set of API's via the application framework (shown in Figure 2, earlier ) to the application for transparently sending an AT command and receiving the corresponding response.

Thus the application has access to a function like Send_AT_Command(char *cmd, char *response) . Using this simple function and following the steps listed in Table 1 earlier, multiple GPRS logical links can be activated.

In order to tests these connection, the programmer can use networking (BSD socket) API's like open_socket, connect_to_socket, send, and receive . An add_route function (usually implemented in the OS through a generic device-level input/output function, ioctl [6]) is also required to explicitly bind a PDP context with a destination IP.

In the Telephone case in Table 3 below we assume the signature of TAPI_Register_Client, TAPI_GPRS_Set_Context and TAPI_Enable_Multiplexer to be provided by the TAPI server implementation on the application processor side.

Table 3: Demo Telephony Programming For Cellular Data Connectivity

Since, in this case, GSM/GPRS module is acting like an external modem, a special AT command in the form of ATD*99*** is usually provided by the protocol stack. This command directly maps on the standard AT+CGDATA command [7] used to setup GPRS data connection.

The purpose of giving this facility is to allow the application to use the popular PPP protocol of dialing, verification and authentication. In order to take full advantage of the modem multiplexer, multiple PPP devices can be used as virtual serial ports acting as GSM multiplexer channels. The Init_ppp_modem and ioctl function are assumed to be provided by the OS on the application side.

Faheem Sheikh joined Embedded Systems Division of Mentor Graphics in 2007. He has worked on application middleware layer of cellular stacks and is currently involved in the multi-core research and prototype efforts. He completed MS degree in computer engineering from Lahore University of Management Sciences in 2005 and is currently pursuing a PhD. He has published in various International Conferences and Journals. His e-mail contact is faheem_sheikh@mentor.com

Irfan Ahmad is a technical lead in Embedded Systems Division at Mentor Graphics. He has 5+ years of embedded development experience spanning RTOS kernels, middleware products and device drivers on a wide range of hardware platforms. He holds bachelors degree in electrical engineering from University of Engineering and Technology (UET) Lahore. He can be reached by e-mail at irfan_ahmad@mentor.com .

References
[1] J. P. Conti, “The internet of things,” Communications Engineer, vol. 4, no. 6, pp. 20-25, Dec- Jan 2006
[2] GSM 07.07 AT Command Set.
[3] R. Kalden, I. Meirick and M. Meyer, “Wireless internet access based on GPRS”, IEEE Personal Communications Magazine, April 2000, pp. 8-18
[4] Broadcom Product Information. http
[5] GSM 07.10 Multiplexing Protocol.
[6] ioctl(2)- Free BSD Systems Call Manual
[7] Siemens GPRS StartUP User Guide.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.