DS28E18 Setup Guide for Remote I2C and SPI Sensors Featuring the DS2485
It is well established that the I2C and SPI communication protocols are designed to be used in short-distance, intra-board communication. This application note discusses the I2C and SPI bus extending capabilities of the DS28E18 1-Wire® to I2C/SPI Bridge with Command Sequencer. Specifically, it covers important measures for setting up a long line, e.g., 100m communication with multiple I2C and SPI sensors and the benefits of using this device.
Introduction
The I2C and SPI communication protocols are well known to have short bus distances that range no more than a couple meters. Although solutions currently exist for extending these ranges, they are often complex and expensive. The DS28E18, however, is a cost-efficient bridge-chip device that demonstrates the benefits of using the 1-Wire interface to get the most range out of complex I2C and SPI devices such as environmental sensors, analog-to-digital converters (ADCs), digital-to-analog converters (DACs), and display controllers, without compromising simplicity. This application note begins by discussing some of the key features and benefits of using the DS28E18 over other bus extending solutions. It also covers the important measures for properly setting up the device for long line communication with multiple sensors.
Device Overview
The DS28E18 1-Wire to SPI and I2C bridge makes connecting offboard peripheral devices faster and easier. Maxim's 1-Wire interconnect technology uses a single wire plus ground to carry power and data to peripherals both on the board and off the board. Devices on a 1-Wire bus are addressable and establish a two-way communication path back to the host microcontroller. The following is what makes the DS28E18 a great I2C and SPI bus extending solution.
Remote Operation
The 1-Wire interface is designed to be robust over long distances. While I2C and SPI bus lengths are limited to only a few meters, the 1-Wire devices can communicate at distances well over 100m. The DS28E18 takes full advantage of this feature to create a long-range connection between the host and an I2C or SPI peripheral, essentially enabling remote operation of I2C and SPI devices.
Reduced I2C and SPI Wiring
But in reality, the interface requires four wires when accounted for power and ground. The same can be said for SPI. Maxim's 1-Wire technology, however, carries both power and data over just one wire. The DS28E18 derives power directly from the 1-Wire circuit and provides it to the I2C or SPI peripheral whenever necessary. As a result, there is no need for an external power source to the peripheral. Therefore, combined with ground, the total number of wires needed to interface with an I2C or SPI peripheral is reduced to just a single wire pair coming from the host.
Autonomous Operation
Power is always a concern when dealing with remote sensing applications. The DS28E18 helps reduce power by offloading some of the host microcontroller's work. This device has an internal sequencer that can be used as a buffer for I2C or SPI commands. The host microcontroller can then command the DS28E18 to execute its stored sequences. In this manner, the host microcontroller can sleep while the DS28E18 autonomously feeds commands to the peripherals and collects data as needed.
Abstract I2C Addresses
Another issue in some I2C applications is device address contention. Many I2C devices have no ability to modify their address or may have an option to change just a couple address bits. This may cause contention issues between multiple I2C slaves on the same bus trying to respond to the same address. The DS28E18 solves that problem because each device has a unique ROM ID with a 48-bit serial number. And, since the 1-Wire bus can carry more than one 1-Wire slave, each I2C device can be connected to a different DS28E18 master and be distinguished by their master's ROM ID, effectively never worrying about any address collisions within the system.
Reduced Cost and Complexity
Typically, systems that can extend a bus over 100m likely require multiple chips on both the host end and the peripheral end. Such configurations can be fairly complex and expensive. The configuration for DS28E18 is quite the opposite. It only requires two pins as opposed to four and six for I2C and SPI, respectively. Furthermore, the host side is mostly just software with a little interfacing hardware whereas the peripheral side consists of only a single DS28E18 device. This makes the DS28E18 a simple and cost-efficient solution for extending an I2C or SPI bus.
Device Setup
The following sections cover important measures for setting up an optimal configuration of multiple DS28E18 nodes remotely connected to the host processor.
Compatible 1-Wire Hosts
Implementing a 1-Wire master is simple and there are various configurations that are compatible with the DS28E18. The most basic implementation is shown in Figure 1 where the 1-Wire master is represented by a microcontroller using general port pins to drive the 1-Wire communication.
Figure 1. DS28E18 host configuration using microcontroller as 1-Wire master.
This type of host configuration presents all of the required components needed to properly operate the DS28E18 with all its features. It keeps hardware costs low as it only requires one spare bidirectional port, and some spare space in the program memory. Typical values of RPUP range from 300Ω–1000Ω but the maximum value may differ depending on the number of DS28E18 nodes connected and bus distance.
Some 1-Wire slaves perform certain operations that require additional power. These are referred to as strong pullup (SPU) operations. The DS28E18 has multiple cases where it performs a SPU operation such as when delivering peripheral power to attached sensors. For this, the host microcontroller from Figure 1 can drive Logic '1' with pin PIOY. Also indicated by the dashed lines is an optional low-impedance bypass of RPUP that can also be used to supply the additional power.
The disadvantage of using a microcontroller as the 1-Wire master is that the 1-Wire timings are generated through software, which can increase the initial software development time and cost. As an alternative, Maxim provides a wide range of 1-Wire master products that can also be used to reliably drive the DS28E18. Figure 2 shows another compatible implementation of a 1-Wire master using the DS2485 I2C-to-1-Wire bridge device.
Figure 2. DS28E18 host configuration using DS2485 I2C-to-1-Wire bridge as 1-Wire master.
The advantage of using the DS2485 is that it does most of the heavy lifting. It is an I2C-to-1-Wire bridge device that interfaces directly to an I2C master, typically a microcontroller, at speeds up to 1MHz. It performs protocol conversion between the I2C master and any downstream 1-Wire slave devices like the DS28E18. It has internal user-adjustable timers to relieve the system host processor from generating time-critical 1-Wire waveforms, supporting both standard and overdrive 1-Wire communication speeds. Once supplied with command and data, the input/output controller of the DS2485 performs time-critical 1-Wire communication functions such as reset/presence-detect cycle, read-byte, write-byte, read-block, write-block, single-bit R/W, triplets for ROM Search, and full command sequences without requiring interaction with the host processor. External pullups on the 1-Wire bus can be avoided as the DS2485 device provides all the necessary pullup features internally.
Wiring for Long Distance
The DS28E18 is most efficient when used as an offboard peripheral. When setting up the device for long distance communication, it is important to mind the bus capacitance introduced by longer lines of cable. Large amounts can impede rise times on the 1-Wire line, effectively interfering with the data transmission. Figure 3 shows an example of a viable long line configuration of the DS28E18. It includes the DS2485 1-Wire master and a 100m-long twisted pair of 24 AWG CAT5E cable connected to the IO and GND pins of the DS28E18. Since the DS28E18 derives its power from the 1-Wire line, there is no need for an additional power line.
Figure 3. DS28E18 remote configuration with DS2485.
Using an APU
There is a notable difference in 1-Wire rising times when compared between a typical onboard connection at 10cm and an offboard connection at 100m with the DS28E18, as shown in Figures 4 and 5, respectively.
Figure 4. 1-Wire line rising edges of an onboard DS28E18 at 10cm and 1000Ω RPUP.
Figure 5. 1-Wire line rising edges of an offboard DS28E18 at 100m and 1000Ω RPUP.
For drastic cases where rising times are too slow, speeding up the transitions can be accomplished by lowering the passive resistor (i.e., RPUP) value on the 1-Wire bus to something on the lower end (e.g., 300Ω). Modifying RPUP value can be accomplished with the DS2485 easily by simply configuring its internal passive pullup resistor value through software.
For cases where lowering the pullup resistor is not enough, the DS2485 also offers an alternative pullup technique called an active pullup (APU). When enabled, an APU essentially bypasses the passive pullup resistor for a limited time with a low-impedance path during the low-to-high transitions of the 1-Wire signal, effectively reaching a high voltage state more quickly. This effect can be seen in Figure 6 where the same rising edges from Figure 5 are noticeably sharper despite having the same 1000Ω Passive Pullup Resistor. Therefore, using an APU is always recommended when communicating with the DS28E18 over long lines.
Figure 6. 1-Wire line rising edges of an offboard DS28E18 at 100m and 1000Ω RPUP with APU enabled.
Given how each DS28E18 has a unique ROM ID, more than one device can be connected to the same 1-Wire bus without having any contention issues. Essentially, this allows a system the ability to incorporate a variety of remote sensors each with their own DS28E18 host. Figures 7 and 8 show a typical DS28E18 node configuration with an I2C and SPI sensor attached, respectively. Dashed lines from Figure 7 indicate optional pullups on the I2C bus for when internal pullups on the DS28E18 are configured to disabled.
Figure 7. DS28E18 node configuration with an I2C sensor.
Figure 8. DS28E18 node configuration with an SPI sensor.
The number of nodes that can be connected to a single 1-Wire bus can reach well up to 10 or more. The maximum number greatly depends on the amount of current drawn at a time from the 1-Wire line during an SPU operation. Having too many nodes on the line could potentially hamper a device's performance if the voltage drop is such that the voltage level at IO is less than the minimum VSPU limit (i.e., 2.0V) during the SPU operation.
The most notable instance of high current draw occurs during a multidrop ROM ID power-up sequence. To elaborate, The DS28E18 always initiates with a default ROM ID value upon power-up. In order to fully operate, the DS28E18 must first populate its unique ROM ID from memory. To do so, the 1-Wire master must issue a 1-Wire Skip ROM (CCh) command followed by a DS28E18 Write GPIO (83h) command. As a result, every DS28E18 connected to the same 1-Wire bus responds to this ROM ID power-up sequence, effectively increasing the current drawn from the 1-Wire line by a significant amount as every device populates their unique ROM ID simultaneously.
To help manage this high current demand when using the DS2485, it is recommended to use an external p-channel like the one shown in Figure 2. This p-channel presents a smaller pullup impedance than the DS2485's internal SPU impedance, which in turn helps drive more current down the 1-Wire line. Note that the DS2485's 1-Wire Block (ABh) command is the only 1-Wire master command with access to the external p-channel and, therefore, must be used to run the multidrop ROM ID power-up sequence. After every DS28E18 node has powered up successfully, normal operation of the DS2485 can resume and the external p-channel can be neglected.
The DS28E18 works as a great solution for extending an I2C or SPI communication. This simple and cost-efficient device provides many benefits over other extending solutions, enabling systems control over multiple sensors at remote distances of up to 100m or more. An optimal hardware configuration can be achieved by following this device setup guide.
Comments
Post a Comment