-
Notifications
You must be signed in to change notification settings - Fork 31
The emb6 Network Stack
#The emb6 Network Stack ##Overview The main objective of the emb6 Networking Stack is to connect embedded devices to the Internet of Things (IoT). Therefore the emb6 Networking Stacks implements all the necessary parts of the 6LoWPAN protocol as described in chapter 6LowPAN. Furthermore it provides additional functionalities such as different application layers and utilities. The following subchapters describe the features, basic concepts and the architecture of the emb6 Networking Stack.
There are several IoT capable stacks available may it be on open source or on commercial basis. The emb6 Networking Stack provides several salient features making it a unique offering. The main features and concepts of the stack are the following:
- Event Driven Operation - Very small RAM overhead, one memory stack for the whole system.
- Scalable Buffer Handling - A common buffer module is used across layer and module boundaries. This decreases memory usage and furthermore provides scalability for usage on different hardware configurations and limitations.
- Static memory management - For additional stability during runtime.
- Compile Time Options - Usage of different compile-time settings help to make an optimum selection regarding to the anticipated use cases as well as to the hardware limitations such as memory size or computing performance.
- Run Time Options - Many stack parameters are accessible and changeable during runtime via remote management.
- Full IPv6 support - The integrated IPv6 protocol is based on the uIP-Stack [1]. This provides full IPv6 support and guarantees further support and maintenance.
- BSP and HAL Abstraction - Hardware dependencies are abstracted with a Board Support Package (BSP) which oers an API between the target and the applications and with a hardware abstraction layer Hardware Abstraction Layer (HAL), which allows independence from the used microcontroller IC.
- Optimized for use in constrained devices - The scalability of the stack enables a manifold
- Routing functionality - The routing functionality is provided by the Routing Protocol for Lossy Networks (RPL) protocol [2],
- Layered Architecture - The design of the software stack follows a strict layered architecture (cf. Fig. 2.1).
- Simple Setup and Configuration - The setup and conguration can be easily executed with the help of centralized configuration files.
- Socket Interface - A BSD like socket API allows easy integration of customized applications.
- Set of included Application Layer Protocols - like Constrained Application Protocol (CoAP), ETSI, LWM2M
- Security Support - A DTLS1.2 protocol stack from the same protocol family can be integrated to ensure transport layer security [3].
Since the emb6 Networking Stack was mainly developed for the usage with resource constrained em- bedded devices, benchmarks especially regarding to memory consumption in FLASH and RAM are key points of the stack implementation. As the emb6 Networking Stack can be configured in many ways and all changes within a configuration affect the resulting memory usage, it is nearly impossible to provide a common number here. However the following table 2.1 gives a basic overview of the memory consump- tion caused by the different configuration based on a sample implementation for different targets with gnu-gcc compiler and activated code optimization level.
| Stack configuration | stk3600 Flash/Ram 45,7/3,4kB | xpro_212b Flash/Ram 46,9/3,4kB | atany900 Flash/Ram 46,6/2,8kB | atany900_rfd Flash/Ram 21,4/1,0kB |
|---|---|---|---|---|
| COAP | 11,6/1,3kB | 11,9/1,3kB | 12,5/1,1kB | |
| RPL | 13,2/0,3kB | 14,4/0,3kB | 11,4/0,2kB | 10,1/0,1kB |
| IPV6 | 16,4/1,5kB | 15,5/1,5kB | 14,7/1,2kB | 10,5/0,7kB |
| SICSLOWPAN | 4,5/0,3kB | 5,1/0,3kB | 0,8/0,3kB | 0,8/0,2kB |
| Table2.1: Sample memory usage |
##Architecture The basic architecture of most of the network stacks follows the so-called Open Systems Interconnection (ISO OSI) reference model, which splits a stack and its communication tasks into several vertical layers. The network related parts of the emb6 network stack also follow this strict layered architecture as shown in figure 2.1. Well-defined interfaces allow easy exchange, modification or removal of single layers as needed. Furthermore, development and maintenance efforts will be decreased.

Figure 2.1 shows the basic architecture of the emb6 network stack with its networking core in the middle of the block diagram. The Networking core handles the network related tasks, mainly the communication part, whereas the different tasks have been split up into several layers. Beginning on top at the Applica- tion Layer (APL), usually serving as interface to the device application, requests will be forwarded layer by layer down to the physical layer (PHY) which is responsible for the implementation of the RF-module drivers. A detailed description of the single layers can be seen from ch. 2.4.1 to ch. 2.4.5. Besides the networking core, a separate so called Utility Module implements all common functionalities such as timer and event handling, which are used by all other layers and modules. A detailed description of the Utility Module can be found in ch. 3.6. To support different hardware platforms including different microcontrollers, RF modules and target boards all hardware dependent parts of the emb6 networking stack are encapsulated in a separate so- called Board Support Package (BSP) which is accessing a hardware dependent hardware abstraction layer (HAL). This allows easy porting of the emb6 Networking Stack across different hardware plat- forms. Detailed descriptions of the BSP/HAL architecture can be found in 3.6.4. Furthermore the emb6 Porting Guide (under construction) provides all information and instructions needed to port the emb6 Networking Stack onto a new platform.
##Description of the Layers ###Application layer The application layers (APLs) are the highest layers of the emb6 Networking Stack and are located above the transport layer (TPL). The APL is an optional part of the emb6 Networking Stack. Depending on the application, different APLs may be used whereas the following are currently included:
- Constrained Application Protocol (CoAP) - The CoAP [?] protocol is HTTP like protocol adapted and optimized for the IoT. It is based on restful services and an according rest-engine which both are also part of this APL.
- ETSI - Under Development
- LWM2M - Under Development
If there is no need for an APL or a proprietary APL shall be used, it is also possible to make direct use of the underlying TPL's socket interface and to communicate using the available transport protocols.
###Transport layer (socket interface) The transport layer is based on the uIP embedded TCP/IP Stack [?]. The transport layer in this stack actually supports only UDP and provides a socket interface to use the data transfer over UDP.
###Network layer The network layer contains two sublayers, the upper IPv6 layer and the lower 6LoWPAN adaption layer. The IPv6 layer includes the routing protocol (RPL) , ICMPv6 and the neighbor discovery protocol (NDP). The 6LoWPAN adaptation layer provides IPv6 and UDP header compression and fragmentation to transport IPv6 packets with a maximum transmission (MTU) of 1280 bytes over IEEE 802.15.4 with a MTU of 127 byte.
###MAC layer (to be extended with a real mac protocol) Actually just wrapper functions for stable functionality for IEEE802.15.4 (but no full feature). Radio duty cycle as a part of IEEE 802.15.4 but not used at the moment. At the moment CSMA functionality is done by the radio transceiver.
###PHY layers The physical layer is represented by the radio-interface driver and supports hardware depended func- tionality of the transceiver, e.g. CSMA and auto retransmission.
###Utility Module The Utility Module provides services to all layers of the emb6 network stack. Here the main event processing and timer handling is done. Also the queue- and packet buer management is implemented in this part of the stack.
##API architecture The emb6 network stack makes use of a structure which is declared in the main function. This structure is named "netstack struct". The netstack structure contains a pointer for each layer which points to a structure with functions provided by the layer. With the pointers the layer specic functions for initializing and packet processing are used. The type denition of the netstack structure gives an overview of the layer structures, cf. Listing 2.1.
typedef struct netstack {
const struct netstack_headerCompression* hc;
const struct netstack_highMac* hmac;
const struct netstack_lowMac* lmac;
const struct netstack_framer* frame;
const struct netstack_interface* inif;
} s_ns_t;Listing 2.1: global netstack struct definition