By Lucio Di Jasio,
Microchip Technology Inc.
If ten years ago a serial port could be considered a kind of universal port, allowing any embedded application to connect to pretty much any computer, printer and modem, today that simplicity is gone. Much more is expected from the embedded applications of the 21st century. Any designer working on applications that require universal connectivity needs to consider offering the basic trio composed of UART, USB and Ethernet. But can this be accomplished efficiently and economically? Can 8-bit architectures still satisfy the new connectivity needs, or has the complexity of the problem ballooned to require the use of 16-bit or even 32-bit processors?
UARTS AND USB
The Universal Asynchronous Receiver and Transmitter (UART) is a very simple and well-understood device. Every competent embedded-control developer learned to master it for implementing the various serial communication protocol flavors (e.g. RS232, RS422, RS485). UARTs can be implemented with a minimal number of gates, hence they are inexpensive and can be found in most modern microcontrollers.
In comparison, USB Serial Interface Engines (SIE) require a much larger number of gates. The USB protocol stack defines, in detail, several (ISO/OSI) layers and therefore requires a few kilobytes of code to implement. Further, depending on the type of interface being implemented, special (OS) drivers might be required. All of this complexity necessitates a more intimate knowledge of the intricacies of the operating system in order to exploit the full potential of the bus. So, while the PC industry has eagerly embraced the USB bus, it is no surprise that the embedded control community has largely resisted this transition.
The options available to the embedded control designer for adding USB are fundamentally two: 1) patching an existing design, or 2) adopting a single chip solution. Both options require a minimal hardware redesign, but the complexity of the project and the performance of the resulting system can vary dramatically. Specifically, in the "patch" approach the resulting system remains limited to the bandwidth provided by the serial interface. In the "single-chip" solution, the native USB interface allows a tighter integration with the application, promising higher performance, component-count reduction and an overall cost reduction. This second approach is driving the USB SIE toward adoption as the natural replacement for the UART peripheral in future "general-purpose" generations of 8-, 16- and 32-bit microcontrollers.
THE INTERNET AND ETHERNET
The other powerful phenomenon affecting the embedded-development community at large is, inevitably, the Internet. It is evident to most of us how deep an impact the pervasiveness of the Internet has had on our daily lives, our work and even our social habits. With great simplification, we could say that the Internet is just the combination of Ethernet networking technology and the TCP/IP protocol acting as the foundation for a number of services that provide us with email (SNMP) and the World Wide Web as we know it (HTTP, FTP, etc.).
The key benefits brought to the embedded control world by Ethernet networking are: 1) wide deployment, i.e., most offices, industrial and residential building are pre-wired; and 2) independence, i.e., support is available on all operating systems, architectures and classes of hardware
The TCP/IP stack, in turn, brings the following benefits: 1) media and bitrate independence, and 2) location independence, i.e., a TCP/IP packet can travel across the world to reach its destination, canceling all distance barriers
Considering the above benefits, the potential that Ethernet connectivity offers the embedded-control world is clear. Traditional Ethernet hardware implementation is often provided in the form of two separate components, commonly referred to as the analog physical (PHY) and the digital media access controller (MAC) modules.
For years, the only option for offering Ethernet connectivity to embedded-control designers has been to reuse Ethernet controllers designed for the PC market. Only very recently, new Ethernet controllers have appeared that are tailored for the embeddedcontrol market (see Figure 1). This new breed of Ethernet controllers offers lower pin count interfaces, replacing the PC-based ISA bus with a simpler SPI interface and adding flexible buffers and filters to increase the efficiency of even the smallest 8-bit microcontrollers in a networked application.
32-, 16- AND 8-BIT SOLUTIONS
In the 32-bit arena, there are several options where processor cores are coupled to chipsets derived from the desktop world. But the use of multitasking 32-bit RTOSes, like Windows, QNX or Linux, makes the software implementation extremely large, requiring several megabytes of RAM and vast Flash storage devices. Many designers have found that these 32-bit solutions can be too expensive and generally overkill for the type of deeply embedded designs that constitute the real high-volume applications such as consumer electronics devices, UPS systems, home and building automation, alarms, diagnostic interfaces for appliances,-smoke detectors and more. In the 16-bit arena, there are a few more frugal examples of integration that could approximate the universal serial port. For example USB and Ethernet MAC interfaces are available on chip (the MAC digital module being easier to integrate). As a result, twochip solutions using an external PHY can be assembled as shown in Figure 2. But how low can you really go? Are there 8-bit solutions available, and if so how effective can they be?
Figure 3shows an example of a possible 8-bit solution, enabled by the recent introduction of two new device types: 1) Ethernet controllers that incorporate both MAC and PHY and communicate with the MCU via SPI, and 2) 8-bit MCUs with native USB interfaces, UARTs, and sufficient performance and amount of Flash memory.
In regards to program memory requirements, 8-bit USB and TCP/IP stacks tend to be much more compact than those of their 32-bit and 16-bit counterparts, while sacrificing little in terms of performance. Also, several stacks available today for the 8-bit world are offered free of charge.
Common to all architectures and manufacturers is use of the C language for its improved readability and ease of support. An estimate of the typical protocol stack requirements for an average 8-bit universal port device would include:
- 25 KB for a complete but lean TCP/IP stack implementation
- 5 to 10 KB more for a typical USB stack, depending on the number and complexity of classes (drivers) supported.
Adding up to 30 to 35 KB, this would amount to 50 percent of all the addressing space available in several traditional 8-bit architectures that are limited to 64 KB of linearly addressable memory. A few innovative 8-bit architectures have demolished that barrier and are capable of offering linear memory addressing well into the megabytes. In these new portfolios, it is not uncommon to find 8-bit microcontrollers with 128 KB or more of Flash, as well as all the peripherals needed to implement a "Universal Port" solution. A twochip solution, as depicted in Figure 3, would still leave two-thirds or more of the program memory available for the target application.
Lucio Di Jasio is the Application Segments Manager for the Analog and Interface Products Division of Microchip Technology Inc. He can be reached by e-mail at [email protected].
Company: Microchip Technology Inc.
Product URL: Click here for more information