Abstract: This application note discusses the core of modern advanced electronics, which is typically a microcontroller that communicates with one or more peripheral devices that were originally memory mapped and connected to the data and address bus. However, due to high pin count, increased package size, and overall cost, another connection/communication scheme became the dominant choice—the serial interface. This article compares different serial interfaces, such as 1-Wire®, SPI, I²C, USB, etc., with respect to physical network size, network drivers, power supply, data rate, network inventory, and choice of functions. It shows how competitive and innovative the 1-Wire serial interface can be to the engineer trying to decide which serial interface to select.
This article was also featured in Maxim's Engineering Journal, vol. 59 (PDF, 497kB).
The heart of today's advanced electronic products is a microcontroller (µC) that communicates with one or more peripheral devices. Initially, µC periphery was memory mapped and connected to the data and address bus. Chip-select signals were decoded from address lines to give each component its unique location in the limited address range. This type of interface determined the minimum number of pins (in addition to power and ground) to 8 (data) plus 1 (R/active-low W) plus 1 (active-low CS) plus n address lines [n = log2(number of internal registers or memory bytes)]. A 16-byte device, for example, needed 8 + 1 + 1 + 4 = 14 pins for communication. The access time was short, but the high pin count increased the package size and the overall cost. The obvious alternative to decrease cost and package size is a serial interface.
Defining a serial bus is not a trivial task. Besides data rate, bit sequence (most or least significant bit first), and voltage, one needs to consider the following:
Table 1 shows the matrix of variations using popular bus systems. Only 4 of the possible 16 combinations are currently known commercial products.
- How the peripheral device gets selected (by hardware through the chip-select input or by a software protocol).
- How the peripheral device stays synchronized with the µC (through a hardware clock line or through clocking information embedded in the data stream).
- Whether data is transmitted on a single line (switching between "high" and "low") or a two-line differential connection (both lines changing their voltage simultaneously, but in the opposite direction).
- Whether both ends of the communication line are electrically terminated with a matching impedance (typical with differential signaling), or whether they are left unterminated or terminated at one end only (typical with single-ended buses).
Beyond these parameters, the application can add further requirements such as the method of power delivery, isolation, noise immunity, the maximum distance between the µC (master) and the peripheral device (slave), or the structure of the cabling (linear, star, insensitive to reversal of wires). These requirements lead to applications such as building automation, industrial control, and reading of utility meters for which special standards have been developed.1, 2
Table 1. Serial Bus Systems Overview
Requirements for Applications from Circuit Board to Backplane
A serial bus system for peripheral functions must not add any significant burden on the system. In particular,
The fewest number of signals is required with single-ended self-clocking systems that use a software protocol for addressing. As shown in Table 1, 1-Wire, LIN bus, and SensorPath meet these criteria. Within this group there are additional factors to consider (see Table 2).
- The connection must be easy to route (the fewer signals the better).
- The protocol must be easy to implement in software (or natively supported by the chosen µC/µP).
- There should be an adequate selection of device functions.
- The bus must be easy to expand.
Table 2. Further Distinctions Among 1-Wire, LIN Bus, and SensorPath Bus Systems
|Physical Network Size
||Board or backplane, can be expanded up to ~300m
|Network Drivers (Hardware)
||Drivers are available for RS-232, I²C, USB, and general µP port pins6, 7
||Drivers are available for µP port pins
||Super-I/O chips, µP port pins
|Network Drivers (Software)
||Available free for various platforms, including µCs8
||Available free for Freescale™ µCs
||Through the data line (typical case), local VCC (some devices)
||Through the data line
||Up to ~15kbps (standard) or ~125kbps (overdrive)9
||Up to ~20kbps
||Data dependent, up to ~20kbps
||Through the "search ROM" network function
||Not applicable, message-based addressing
|Choice of Device Functions
||Large variety of device functions, including serial number, instrumentation, secure memories, etc.
||Limited to functions needed in automotive applications
||Limited to temperature sensors and voltage ADCs
Physical Network Size
Only SensorPath is limited to board-size applications. Under certain conditions and using appropriate hardware and software network drivers, the size of a 1-Wire bus can be expanded significantly.
For protocol-based networks, one needs software drivers to generate the communication waveforms (link layer), to identify and address an individual slave/node in the network (network layer), and to transmit/receive data to or from a device (transport layer). Software drivers are specific for an operating system and communication port. There are 1-Wire hardware driver chips (masters) and adapters for ports such as COM, LPT, USB, and I²C. For large unterminated networks, reflections from cable ends, connectors, and stubs can limit the performance.
Each device in a network must be powered for operation. Most cost effective is a remote supply accessed through the data line. This method, also called "parasite power," makes it possible to read system diagnostic information (e.g., in power-down mode). For an example, refer to Figure 3 and the related text in application note 178, "Printed Circuit Board Identification Using 1-Wire Products."10 Parasite power, however, reduces the achievable data rate, as time must be set aside for power delivery.
Generally, a higher data rate is associated with a reduced network size and vice versa. In a 1-Wire system, due to the power-delivery feature, the maximum data rate depends on the number of slave devices in a network and the overall length (capacitance) of the cable.
This feature allows the master to identify the number, type, and addresses of slave devices in a network. It is a prerequisite for networks with a dynamic (changing) population. Refer to page 22 of the Dallas Engineering Journal (vol. 2)11 for an example.
Choice of Device Functions
The best interface is useless if the device functions required for an application are not available. Compared to LIN bus and SensorPath, 1-Wire has by far the largest selection of functions.
I²C/SMBus vs. 1-Wire
If the application can support a clock line, then the choice can be extended to I²C12 and SMBus13 devices. In its initial specification, the SMBus was mostly a variation of the original 100kbps I²C bus specification with a timeout feature added. This timeout prevents the bus from becoming inoperable from a node that has lost synchronization with the bus driver; an I²C system requires a power-on reset to recover from this situation. In 1-Wire systems, the reset/presence-detect cycle resets the communication interface to a defined starting condition.
Besides the clock line, I²C/SMBus uses an acknowledge bit for every byte that is communicated on the bus. This reduces the net data rate by 12%. Transactions begin with a start condition followed by a device address and a data-direction bit (read or write), and they end with a stop condition. In 1-Wire systems, the requirements of the network layer must first be met (i.e., selecting a particular device or search ROM or broadcast); subsequent communication begins with a device-specific command code, which also affects the data direction (read or write).
A serious issue of the original I²C and SMBus is the limited 7-bit address space. With more than 127 different device types available, one cannot deduct the device function from its slave address. In addition, many I²C devices allow the user to set one or more address bits arbitrarily to have several equal devices on the bus. This feature also reduces the available address space. The standard method to work around address conflicts is splitting a bus into several segments and activating one segment at a time under software control. This segmentation requires more hardware and complicates the application firmware. The lack of an inventory function or enumeration makes it difficult for an I²C system to handle a dynamic population. This issue is solved with the Address Resolution Protocol of SMBus Specification Version 2.0.13 However, there are only a few SMBus devices available that support this feature.
SPI and MICROWIRE
SPI14 and MICROWIRE15, a subset of SPI, require an additional chip-select line for each device. Due to the chip-select signal, the SPI protocol only defines commands such as read and write for memory addresses and the status register. It does not use an acknowledge function. Typically, SPI devices have different pins for data input and data output. Because the data output is tristated (disabled) for anything except read functions, the two data pins can be tied together to form a single bidirectional data line. SPI is chosen for functions that are not available in other bus systems or for its fairly high data rate, which may be 2Mbps or higher. A downside of SPI and MICROWIRE is the decoder that generates the active-low CS signal to address an individual chip. However, there are no address conflicts. As with I²C, there is no inventory function. The master cannot deduct the device function from its logical address, which makes it difficult to manage a network with a dynamic population.
RS-485, LVDS, CAN, USB 2.0, and FireWire
These standards are discussed here as examples for differential signaling. The two fastest systems in this group, FireWire16 and USB 2.017, are electrically point-to-point connections. Using sophisticated nodes or hubs, they implement a virtual bus of a tree-like topology where data packets are transmitted from source to endpoint (USB) or peer-to-peer (FireWire) at a burst data rate of up to 480Mbps (USB 2.0) or 1600Mbps (FireWire). The limited packet size and the receive/buffer/retransmit communication concept add latency, which in turn reduces the achievable data throughput. Topology and protocol permit a maximum of 126 nodes for USB and 63 nodes for FireWire with a maximum distance of 4.5m between nodes using passive cable. Designed for applications such as PC periphery, multimedia, industrial control, and aviation (FireWire only), USB and FireWire devices can be plugged in without powering down the system (hot-swapped). This allows the network's population to change dynamically.
LVDS18, RS-48519, and CAN20 implement a true linear bus structure with masters and slaves or even multiple masters. The fastest of these standards, low-voltage differential signaling (LVDS), can operate at 100Mbps if the bus size does not exceed 10m. Depending on the network size, the achievable data rate and throughput can be higher or lower. Designed as the electrical standard for backplane applications, LVDS allows hot-swapping, but does not specify any protocol.
RS-485 also specifies only the electrical parameters. Instead of nodes, RS-485 defines loads and the maximum number of loads per bus, which is 32. One electrical node can have a load of less than 1. Typical data rates are up to 35Mbps at 12m and 100kbps at 1200m network size, which are adequate for data acquisition and control applications. The protocol of RS-485 equipment is often based on components originally designed for RS-232.
The controller area network (CAN), in contrast, defines a serial communications protocol for distributed real-time control with a very high level of security, geared towards automotive applications and industrial automation. The data rate ranges from a network size of 1Mbps at 40m down to 50kbps at 1000m. The addressing is message-based without any protocol-inherent limitation to the number of nodes. CAN nodes can be hot-swapped for dynamic change of the network's population.
In the group of simple, low-cost bus systems, 1-Wire has the largest variety of device functions and network drivers as compared to LIN bus and SensorPath. I²C and SMBus require a clock line and VCC power in addition to data and ground reference, but offer an impressive choice of device functions. SPI and MICROWIRE need an additional chip-select line, but communicate at significantly higher data rates. With its parasitic power supply and network inventory function, the 1-Wire interface and protocol support hot-swapping, a feature that is otherwise only found in high-speed systems that use differential signaling and in SMBus 2.0-compliant products. The best-known examples of hot-swapped 1-Wire devices are iButton® products, in which hot-swapping is the normal way of operation. 1-Wire devices have proven to be very efficient for functions such as global identification21, circuit boards/accessory identification and authentication10, temperature sensing, and actuation. Other very successful products are 1-Wire devices with secure memory and challenge-and-response functionality that protect intellectual property at a minimal cost through two-way authentication.22, 23
A similar article appeared in the September 2006 issue of Electronic Products.
- Interbus Club. www.interbusclub.com/ (industrial automation)
- The valid M-Bus standard. www.m-bus.com/ (meter reading)
- "Overview of 1-Wire Technology and Its Use." www.maximintegrated.com/AN1796 (intro to 1-Wire)
- LIN Local Interconnect Network. www.lin-subbus.org/ (LIN specification)
- National Semiconductor. "Cost Effective Partitioning of IO and Management Functions in PCs - Introduction of SensorPath™ Technology." www.national.com/nationaledge/jan04/article.html (SensorPath)
- "Advanced 1-Wire Network Driver." www.maximintegrated. com/AN244 (hardware driver)
- "Guidelines for Reliable Long Line 1-Wire® Networks." www.maximintegrated.com/AN148 (1-Wire networks)
- "1-Wire® Software Resource Guide Device Description." www.maximintegrated.com/AN155 (software drivers)
- "Determining the Recovery Time for Multiple-Slave 1-Wire Networks." www.maximintegrated.com/AN3829 (recovery time)
- "Printed Circuit Board Identification Using 1-Wire Products." www.maximintegrated.com/AN178 (board identification)
- "Dallas Engineering Journal," vol. 2. pdfserv.maximintegrated.com/en/ej/DallasEJ2.pdf (dynamic network)
- "The I²C-Bus Specification, Version 2.1, January 2000." www.nxp.com/acrobat_download/literature/9398/39340011.pdf (I²C)
- "SMBus Specifications." www.smbus.org/specs/ (SMBus)
- "M68HC11E Family." www.freescale.com/files/microcontrollers/doc/data_sheet/M68HC11E.pdf (SPI)
- "MICROWIRE™ Serial Interface." www.national.com/an/AN/AN-452.pdf (MICROWIRE)
- The Air Power Australia Website. "Firewire." www.ausairpower.net/OSR-0201.html (FireWire)
- "USB 2.0 Specification." www.usb.org/developers/docs (USB specification)
- National Semiconductor. "LVDS Owner's Manual: Low-Voltage Differential Signaling." www.national.com/appinfo/lvds/files/ownersmanual.pdf (LVDS)
- Lammert Bies' Website. "RS485 serial information." www.lammertbies.nl/comm/info/RS-485.html (RS-485)
- Robert Bosch GmbH. "CAN Specification, Version 2.0." http://www.academia.edu/33475371/BOSCH_CAN_Specification (CAN specification part A)
CAN in Automation (CiA). "CAN Specification 2.0, Part B." www.can-cia.org/index.php?id=441 (CAN specification part B)
- "Creating Global Identifiers Using 1-Wire Devices." www.maximintegrated.com/AN186 (global identifier)
- "Protecting the R&D Investment—Two-Way Authentication and Secure Soft-Feature Settings." www.maximintegrated.com/AN3675 (two-way authentication)
- "Xilinx® FPGA IFF Copy Protection with 1-Wire SHA-1 Secure Memories." www.maximintegrated.com/AN3826 (FPGA protection)
1-Wire is a registered trademark of Maxim Integrated Products, Inc.
FireWire is a registered trademark of Apple Inc.
SensorPath is a registered trademark of Winbond Electronics Corporation.
||iButton Monetary Device with SHA-1 Function
||Silicon Serial Number
The content on this webpage is protected by copyright laws of the United States and of foreign countries. For requests to copy this content, contact us.
|© Jan 30, 2007, Maxim Integrated Products, Inc.
APP 3967: Jan 30, 2007
APPLICATION NOTE 3967,