Simplify the Internet of Things connectivity of embedded devices
According to ABI Research, there are more than 10 billion wirelessly connected devices in the market today, and more than 30 billion devices will be wirelessly connected to the Internet of Things (Internet of Everything) by 2020.
With so much focus on the Internet of Things, many OEMs find themselves under increasing pressure to introduce Internet connectivity to a wide range of devices that can benefit from being able to communicate with other devices.
However, many developers are unfamiliar with how to implement a robust TCP/IP stack. This article will explore key issues relating to enabling Internet connectivity in embedded systems, as well as discuss how new tools allow developers to introduce TCP/IP to systems without having to work with low-level implementation details.
The TCP/IP protocol
The TCP/IP (Transmission Control Protocol/Internet Protocol) is the common language used to exchange data between hardware devices connected to the Internet. These rules govern the exchange mechanism between the terminal operating system (Windows, iOS, Linux, etc.), and a set of specific protocols, including SMTP, FTP, HTTP, etc.
TCP/IP is subdivided into “layers” (Figure 1). Internet data is routed from the Application layer to the Transport layer in the format of data fragments. The Physical layer is where data is physically moved through “The Internet” under the Ethernet protocol defined by the IEEE 802.3 specification. Ethernet comes in many flavors offering different maximum bit rates, modes of transmission, and transmission media (Fiber, Coax, etc.). The Media Access Control (MAC) is a significant part of the physical layer, and the MAC address represents the physical address of the node(s) on an Ethernet network. Every Ethernet frame contains both a source and destination address.
The Application layer provides the user interface. The following are the common application layer protocols  .
- Hyper Text Transfer Protocol (HTTP): Transfer data associated with browsing of the World Wide Web.
- Simple Mail Transfer Protocol (SMTP): Deliver e-mails across the internet
- File Transfer Protocol (FTP): Transfer files over the internet
- Domain Name System (DNS): Translate domain names
- Dynamic Host Configuration Protocol (DHCP): Dynamically assign IP addresses to a particular node
- Telnet: Establish an interactive TCP connection to a node.
- Simple Network Time Protocol (SNTP): Allow nodes to synchronize their clocks to a reference clock.
- Simple Network Management Protocol (SNMP): Used to monitor network attached devices for conditions that require intervention, such as faults, etc.
TCP/IP and the Internet of Things
Two of the most common uses of an embedded TCP/IP stack are for messaging and web page display. For example, a simple SMTP-based messaging system allows a microcontroller to take sensor readings and, at a pre-determined interval, email or message those readings to a centralized repository for logging and analysis.
Such an application in the home might be to email the temperature of the house to residents every hour. Of course, this example can be extended much further. The embedded microcontroller might also monitor whether the doors and windows are locked and the lights are off.
The system monitors this information throughout the day. If the resident is going to be home late from work, he or she can use HTTP to request that the micro send a web page with all of this information. The resident could then turn lights on in certain rooms, bump up the temperature, and perform other tasks by changing a few fields on the web page.
There are multiple ways to implement an Ethernet subsystem that matches each system’s requirements.
Ethernet controller module A controller module that includes a TCP/IP hardwired chip, transformer, and RJ45 can greatly simplify connectivity. A wide variety of modules are available off-the-shelf that provide fast time-to-market and attractive price points. This approach is ideal for engineers who want to develop an Internet-enabled system rapidly.
For example, developers can select modules like Wiznet’s WIZ550io, W5100 shield, and Rabbit Semiconductor’s Ethernet Modules RCM6760 MiniCore. With the growing popularity of the Arduino platform, the market is also starting to see many modules compatible with official Arduino boards.
TCP/IP IC plus an MCU Designers can also attach a TCP/IP controller to their embedded microcontroller. For example, Microchip’s ENC28J60 Ethernet Module can be directly connected to most microcontrollers with a SPI interface. These modules typically have a stand-alone Ethernet Controller IC with a host of features to handle most of the network protocol requirements. Infrastructure like this enables designers to build and share their own Ethernet projects. For example, there is a project on Github that enables Internet connectivity between Programmable System-on-Chip (PSoC) controllers and a device based on the ENC28J60. The same project that is based on PSoC 3 can be ported to PSoC 5 as well. The advantage of such an implementation is that it frees up the microcontroller core and other on-chip resources for other system functions. At the hardware level, we need only an RJ45 connector, magnetics, a 25 MHz crystal or oscillator, and a few passive components.
Single-chip microcontroller with lwIP Lightweight IP (lwIP) is a widely used, open source TCP/IP stack designed for embedded systems, and is maintained by a worldwide network of developers. For many applications, lwIP can deliver Ethernet functionality while significantly reducing resource utilization of the MCU. Both MAC and PHY are physically required in the MCU to implement the stack.
lwIP is ideal for designers who are seeking an economical approach to connectivity. However, as it takes more of a DIY type of implementation, developers must also be willing to put in the effort to figure out the stacks. The challenges with this kind of implementation are system resource usage and the capability to dynamically assign MAC addresses. The dynamically re-configurable nature of a PSoC makes it possible.
The digital side of PSoC is composed of Universal Digital Blocks (UDB) that balance configuration granularity and efficient implementation. A cornerstone of this approach is to provide the ability to customize the device’s digital operation to match application requirements. For example, the DMA on chip makes it possible to design configurable a RX & TX FIFO. The PSoC design environment allows developers to build their own Ethernet Component and use it as a virtual chip in the system-level design.
Connectivity is the future, and the world is being driven by the Internet to facilitate and expand communications. With silicon vendors offering more mature products with greater implementation options and flexibility, designers have the choice of purchasing at the level they need, from ready turnkey modules to DIY embedded approaches.
Meng He graduated from Marquette University with a Master of Science degree in Electrical Engineering and has been working at Cypress Semiconductor as a product manager since 2007. You can contact Meng at email@example.com.
1. “Ethernet Theory of Operation”, Application Note, Microchip Technology