Introduction to Networking
Networking is a new concept for many embedded engineers. The goal of this book, therefore, is to provide a bridge that spans from basic concepts to how to add networking functionality to an embedded design. This chapter provides a quick introduction to networking protocols and then moves rapidly to a discussion on TCP/IP over Ethernet, today’s preferred network technology combo with the widest usage in terms of the number of devices and applications.
Adding connectivity to an embedded system is now increasingly common, and networking options are numerous. While networking platforms include wireless (Bluetooth, ZigBee, 3G Cellular, Wi-Fi, etc…) and wired (TCP/IP over Ethernet, CAN, Modbus, Profinet, etc…), the networking technology that has revolutionized communications is the Internet Protocol (IP).
NETWORKING
The foundation of communications that we use on a daily basis is the Public Switched Telephone Network (PSTN), a global collection of interconnected public telephone networks. This circuit-switched network was the long-standing fixed line analog telephone system of the past. Today, analog has mostly given way to digital and the network includes both fixed-line telephones and mobile devices.
With PSTN, network resources are dedicated for the duration of the service, typically the length of a phone call. The same can be said for all real-time services such as voice and video. In a real-time service the data transmitted is inherently time sensitive. In the following diagrams, elements composing the network between two connected devices are often represented as a cloud. Clouds are shown in subsequent diagrams throughout this book.

Figure 2-1 represents a circuit-switched network such as the PSTN. In such a network, elements represented by telephone switches allocate network links between a source and destination, in both directions (full duplex), for the duration of the service. Once the circuit is established, switches do not intervene until it is time to dismantle the circuit (one of the parties hangs up). In this situation, the switches are aware of the connection, however the terminals are not.
With data services, when data is transferred, data is chopped into small entities called packets. Network resources are used only when a packet is transferred between a source and destination. This leads to improved network asset utilization as the same equipment can be used to forward packets between different sources and destinations. A permanent connection is not required since the transfer is not time sensitive. if we receive an e-mail a fraction of a second late, nobody will complain!

Figure 2-2 represents a packet-switched network wherein terminals are the extremities of the network connections and are referred to as either hosts or devices. The network elements forwarding packets from the source to a destination are called nodes. Packets are forwarded on a node-to-node basis, one hop at a time, a hop being the path segment between two nodes. Each packet is processed by each node on the path between the source and the destination. In an IP network nodes are called routers.
IP networks are not limited to use by computers (PCs) and mainframes. In fact, increasingly more networks are formed with embedded systems: factory floor automation, household and office devices including heating systems, ovens, washing machines, fridges, drink dispensers, security alarms, Personal Digital Video Recorder, intelligent set-top-boxes, audio equipment, and more. In fact, it is easy to imagine that your refrigerator, washing machine, dryer or toaster will be Internet enabled in the not so distant future.
In Figure 2-2, packets travel in one direction, from the PC workstation to the embedded system. In a full-duplex exchange, two paths are used and processing is performed in both directions. The same processing is required for packets traveling from the embedded system to a PC workstation. An important aspect of packet switching is that packets may take different paths from a source to a destination. In this example, it is possible for packet #2 to arrive before packet #1.
In a packet-switched network, nodes are very busy since the same processing is required for every packet transmitted from the source to the destination. However, the nodes are not aware of the connection, only the terminals (hosts and devices) are. Modern networks extensively use packet switching technology. The main characteristics of a packet-switching network include:
- Networks transfer packets using store-and-forward
- Packets have a maximum length
- Long messages are broken into multiple packets (i.e., fragmentation)
- Source and destination addresses are stored in every packet
Packet Switching technology uses packet switches (computers) and digital transmission lines. It features no per-call connections. The network resources are shared by all communications. It also uses a store-and-forward mechanism referred to as routing in IP technology.
Store-and Forward:
- Stores each arriving packet
- Reads the destination address in the packet
- Consults a routing table to determine the next hop
- Forwards the packet
At the end of the 1990’s, for the first time, data service bandwidth began to exceed real-time services bandwidth. This trend created a dilemma for telecom operators. They were forced to decide whether to make capital expenditures on PSTN equipment to provide both real-time and data services when the latter represented the majority of the traffic. If not, how could they monetize their investment on the data-service side?
Today, most networking-related capital expenditure is spent on equipment supporting data services. Two technologies receiving the majority of this investment are Ethernet and Internet Protocol (IP), which are increasingly evident in embedded systems. This investment ensures that, in the near future, our phone services will run exclusively on Voice over IP (VoIP) and our television over IP networks (IPTV). Voice, video and all real-time services with time-sensitive data will depend upon IP technology.
The Internet Protocol is rapidly becoming the ubiquitous network technology. The related protocol stack used by a myriad of devices is called a TCP/IP stack.
WHAT IS A TCP/IP STACK?
The Internet Protocol suite (also referred to as network protocol suite) is the set of communication protocols upon which the Internet and most commercial networks run. Also called TCP/IP stack, it is named after two of the most important protocols that comprise it: the Transmission Control Protocol (TCP) and Internet Protocol (IP). While they are important networking protocols, they are certainly not the only ones.
THE OSI SEVEN-LAYER MODEL
The Internet Protocol suite can be viewed as a set of layers. Each layer solves a set of requirements involving the transmission of data, and provides a well-defined service to upper-layer protocols by implementing services provided by lower layers.
Upper-layer protocols are logically closer to the user and deal with abstract data while lower-layer protocols translate data into a form that can be physically transmitted. Each layer acts as a "black box" containing predefined inputs, outputs, and internal processes.
For clarity regarding layers, we define:
Layer: A grouping of related communications functions
- Each layer provides services to the layers above
- Layering introduces modularity and simplifies design and modification
Protocol: Rules governing how entities in a layer collaborate to deliver desired services:
- There may be several protocols in each layer
Application: That which is accessed by the end user to perform a function. The application layer is built on top of a "stack" of protocols.