REFERENCE SCHEMATIC 4206

Choosing the Right 1-Wire® Master for Embedded Applications

By:  Bernhard Linke, Principal Member Technical Staff
Mar 27, 2008

Abstract: This application note presents four categories of 1-Wire master circuits for embedded applications and discusses their capabilities and requirements in relation to available (i.e., unused) system resources. The schematics shown here apply to short networks that do not extend beyond the radius of 1 meter and are populated with a small number of 1-Wire slaves. Instructions and a decision worksheet are included to identify the most cost-effective 1-Wire master for the application. The reader should be familiar with the basics of 1-Wire communication and microcontrollers.

Introduction

The 1-Wire bus is a simple signaling scheme that performs half-duplex bidirectional communications between a master controller and one or more slaves sharing a common data line. Both power delivery and data communication take place over this single line, making 1-Wire devices unmatched in their ability to provide key functions to systems where interconnect must be minimized. The 1-Wire products provide combinations of memory, mixed-signal, and secure authentication functions through a single-contact serial interface. Typical applications of 1-Wire devices are: identification of print cartridges or medical consumables; calibration and control of rack cards; identification and authentication of printed circuit boards, accessories, and peripherals; and protection of intellectual property, clone prevention, and secure feature control.

To take advantage of 1-Wire technology, one needs a 1-Wire master that generates the waveforms to identify the devices on the bus and to communicate with them. There are numerous ways to construct a 1-Wire master. This application note discusses masters for embedded applications, i.e., short networks that do not extend beyond the radius of 1 meter and have no more than three to five 1-Wire slaves. For designs using 1-Wire for longer lines or with a larger number of slaves, refer to application note 148, "Guidelines for Reliable Long Line 1-Wire® Networks."

The 1-Wire masters described in this application note are compatible to host circuits that operate on a 3V to 5V supply. The circuits that do not involve protocol conversion can also be used with hosts that operate on a supply of less than 3V. In that case, a voltage-level translator between the master and 1-Wire slaves is needed. Application note 4477, "Reference Design of a 1-Wire® Bidirectional Voltage-Level Translator for 1.8V to 5V," presents such a circuit. RPUP in this application note corresponds to R4 in application note 4477.

1-Wire Glossary

There are several terms commonly found in 1-Wire documents that should be explained at the outset.

Host Interface

The circuits discussed in this document are 1-Wire masters; they all communicate with 1-Wire slaves. These
1-Wire masters, however, cannot function as stand-alone entities; they need a host (computer) that tells them what to do on the 1-Wire side. Host interface refers to the type of connection between 1-Wire master and the "commander on the next higher level in the hierarchy", i.e., the host.

Operating Voltage

Typically, 1-Wire devices function over the range of 2.8V (min) to 5.25V (max). Most 1-Wire devices have no pin for power supply. Such devices are parasitically supplied with power through the 1-Wire communication line. Therefore, operating voltage and 1-Wire pullup voltage are practically synonymous. The higher the operating (pullup) voltage, the more power the 1-Wire devices can receive. More voltage also allows more 1-Wire slaves in the network, or less recovery time between time slots.

Strong Pullup

Strong pullup refers to a means for providing extra power to the 1-Wire network between time slots. Extra power is needed for several functions: by EEPROM devices, e.g., when copying data from a buffer to EEPROM cells; with secure memories, when the SHA-1 engine is running; or with 1-Wire temperature sensors during a temperature conversion. When such 1-Wire devices are used in a 3V environment, strong pullup is necessary; in a 5V environment with the same 1-Wire slaves, strong pullup may be optional. For guidance on when to use strong pullup or how to find the right pullup resistor value, see application note 4255, "How to Power the Extended Features of 1-Wire® Devices."

1-Wire Timing

This is a general expression for the shape of the 1-Wire time slots and the reset/presence detect sequence, and the means to generate these waveforms. One can use special hardware (e.g., chips with their own timing generator) or simply generate the waveforms through software. The hardware method is easier for the software developer, but requires another chip. The software method saves on hardware cost, but will likely increase the cost of software development and testing if no software support is available for the chosen microcontroller. Special consideration is required for the software method if the application software is written in a high-level programming language. It may be necessary both for the low-level functions to generate time slots and for the reset/presence detect sequence to be written in assembly language, so that individual instructions and the number of clock cycles to execute them can be calculated.

Overdrive Support

Most 1-Wire slaves can communicate at two speeds: standard speed and overdrive speed. In overdrive, the timing is approximately eight times faster than at standard speed. All 1-Wire slaves can communicate at standard speed. All masters discussed in Categories 2 to 4 (see discussion below) support overdrive. In Category 1 the overdrive support depends on the capabilities of the microcontroller (clock rate, number of clock cycles per instruction cycle).

Active Pullup

The 1-Wire bus or network is an open-drain environment, with 0V (logic 0) being the active state. When idle, the bus is pulled high to the pullup voltage through a resistor (resistive pullup). Falling edges, consequently, are sharp; rising edges, due to the resistor and the parasitic supply, can be quite slow. Active pullup refers to a method that tests rising edges, and, if a specific threshold has been crossed, bypasses the pullup resistor for a limited time with a low-impedance path. Active pullup is generally not needed in short networks or with a single slave device. If available, active pullup recharges the 1-Wire line faster than resistive pullup and, therefore, supports multiple 1-Wire slaves in the network without having to extend the recovery time between time slots. The 1-Wire masters differ in the strength (impedance) of the bypass and the method that controls the duration of the active pullup.

1-Wire Master Circuits

This section discusses the various master circuits in detail. The circuits are grouped into four categories:
  1. Microprocessor Port-Pin Attachments
  2. Microcontroller with Built-In 1-Wire Master
  3. Synthesizable 1-Wire Bus Master
  4. Serial Interface Protocol Conversions
Each category presents one or more circuits. It shows the schematic, lists the prerequisites, weighs upsides and downsides, hints on what to watch for, and recommends additional reading and URLs to supporting software.

Category 1. Microprocessor Port-Pin Attachments

Figure 1 shows the most basic implementation of a 1-Wire master.

As the only prerequisite, this circuit requires one spare bidirectional port and some spare space in the program memory. The upside of this circuit is its unbeatably low, additional hardware cost, just a pullup resistor. On the downside, the 1-Wire timing is generated through software, which can increase the initial software development time and cost. Depending on the 1-Wire slaves in the application and on the 1-Wire pullup voltage, an additional port pin may be required to implement a strong pullup. The maximum operating voltage on the 1-Wire bus is determined by the characteristics of the bidirectional port (look for 5V tolerance). With more than one slave on the 1-Wire bus, the value of RPUP needs to be lowered. In that case check whether the resulting VOLMAX is compatible to the 1-Wire slaves and to the microprocessor's port input characteristics. Communication at overdrive speed requires a microcontroller with a high clock frequency and/or a low number of clock cycles per instruction cycle. For additional information, refer to application notes 3829, "Determining the Recovery Time for Multiple-Slave 1-Wire Networks," and 126, "1-Wire Communication Through Software." Examples of application software are found in the 1-Wire Public Domain Kit.

Figure 1. Bidirectional port pin with optional circuit for strong pullup (dashed lines).
Figure 1. Bidirectional port pin with optional circuit for strong pullup (dashed lines).

Figure 2 shows another basic circuit similar to Figure 1.

As a prerequisite, this circuit requires two spare unidirectional ports, a pulldown transistor, and some spare space in the program memory. The upside of this circuit is that is does not need a bidirectional port. On the downside, the 1-Wire timing is generated through software, which can increase the initial software development time and cost. Depending on the 1-Wire slaves in the application and on the 1-Wire pullup voltage, an additional port pin may be required to implement a strong pullup. The maximum operating voltage on the 1-Wire bus is determined by the characteristics of the input port (look for 5V tolerance). With more than one slave on the 1-Wire bus, the value of RPUP needs to be lowered. In that case, check whether the resulting VOLMAX is compatible with 1-Wire slaves and the microprocessor's port input characteristics. Communication at overdrive speed requires a microcontroller with a high clock frequency and/or a low number of clock cycles per instruction cycle. For additional information, refer to application notes 3829, "Determining the Recovery Time for Multiple-Slave 1-Wire Networks," and 126, "1-Wire Communication Through Software." Examples of application software are found in the 1-Wire Public Domain Kit.

Figure 2. Unidirectional port pins with optional circuit for strong pullup (dashed lines).
Figure 2. Unidirectional port pins with optional circuit for strong pullup (dashed lines).

Category 2. Microcontroller with Built-In 1-Wire Master

The circuit in Figure 3 is very similar to that in Figure 1. The difference is in the type of microcontroller.

As the main prerequisite, this circuit requires a microcontroller with built-in 1-Wire master, e.g., the DS80C400, DS80C410, or DS80C411, and some spare space in the program memory. The upside of this circuit is that the 1-Wire timing is generated by hardware, which can reduce the initial software development time and cost. Consequently, the entire application software can be written in high-level language. Microcontrollers of the DS80C400 series do have 5V-tolerant ports. On the downside, only high-end microcontrollers have a built-in 1-Wire master. Depending on the 1-Wire slaves in the application and on the 1-Wire pullup voltage, an additional port pin may be required to implement a strong pullup. With more than one slave on the 1-Wire bus, the value of RPUP needs to be lowered; in this latter case check whether the resulting VOLMAX is compatible with 1-Wire slaves and port input characteristics. For additional information, refer to application notes 3829, "Determining the Recovery Time for Multiple-Slave 1-Wire Networks," and 613, "Using the Keil C Compiler for the DS80C400," and the DS80C400 data sheet. Examples of application software are found in the 1-Wire Public Domain Kit.

Figure 3. Microcontroller with built-in <nobr>1-Wire</nobr> master and optional circuit for strong pullup (dashed lines).
Figure 3. Microcontroller with built-in 1-Wire master and optional circuit for strong pullup (dashed lines).

Category 3. Synthesizable 1-Wire Bus Master (ASIC/FPGA)

The circuit in Figure 4 is very similar to that in Figure 3. The difference is that the microcontroller and 1-Wire port are embedded in an ASIC or PFGA.

As the main prerequisite, this circuit requires an ASIC or FPGA with microcontroller capability, at least one spare bidirectional port pin, 3470 unused gates, and some spare space in the program memory. The upside of this circuit is that the 1-Wire timing is generated by hardware, which can reduce the initial software development time and cost. Consequently, the entire application software can be written in high-level language. On the downside, not all ASICs or FPGAs have 5V-tolerant ports. The 1-Wire operating voltage is limited by the port characteristics of the ASIC/FPGA. Some 2.5V FPGAs do have 5V-tolerant I/O ports, which is preferable over 3.3V FPGAs. Depending on the 1-Wire slaves in the application and on the 1-Wire pullup voltage, an additional port pin may be required to implement a strong pullup. With more than one slave on the 1-Wire bus, the value of RPUP needs to be lowered; in this latter case check whether the resulting VOLMAX is compatible with 1-Wire slaves and port input characteristics. For additional information, refer to application notes 119, "Embedding the 1-Wire® Master in FPGAs or ASICs," 120, "Using an API to Control the DS1WM 1-Wire® Bus Master," 145, "Interfacing the 1-Wire Master (DS1WM) to an ARM7 Processor," and 3829, "Determining the Recovery Time for Multiple-Slave 1-Wire Networks." See also the DS1WM data sheet. To obtain the 1-Wire master Verilog®/VHDL code, please submit a tech support request. Examples of application software are included in application notes 120 and 145.

Figure 4. ASIC/FPGA with optional circuit for strong pullup (dashed lines).
Figure 4. ASIC/FPGA with optional circuit for strong pullup (dashed lines).

Category 4. Serial Interface Protocol Conversions

The circuit in Figure 5 requires just one additional component to add a full-featured 1-Wire master.

As the main prerequisite, this circuit requires a way to control a UART, such as a microcontroller, FPGA, or PC serial port, and some spare space in the program memory. The upside of this circuit is that the 1-Wire timing is generated by hardware, which can reduce the initial software development time and cost. Consequently, the entire application software can be written in high-level language. Through control registers, the 1-Wire timing can be fine-tuned. The DS2480B supports a strong pullup and active pullup. Fine-tuning of the 1-Wire timing and active pullup are not needed for embedded applications, however. The built-in 4-bit search accelerator makes the 1-Wire ROM search easier to implement in software. On the downside, the DS2480B is more costly than the discrete components shown in Figures 1 through 4. The DS2480B works with 5V only. It is the strongest single-chip 1-Wire master available—good for communicating with a large number of slave devices. The active pullup lasts until a second threshold has been crossed. The DS2480B can also program 1-Wire EPROM devices. For additional information, refer to application notes 192, "Using the DS2480B Serial 1-Wire Line Driver," 4104, "Understanding and Configuring the 1-Wire Timing of the DS2480B," and the DS2480B data sheet. The source code of application note 192 is available for download.

Figure 5. UART/RS-232 interface.
Figure 5. UART/RS-232 interface.

The circuit in Figure 6 is most convenient for applications that already use an I²C bus.

As its main prerequisite, this circuit requires an I²C bus controller, such as a microcontroller or FPGA/ASIC, and some spare space in the program memory. The upside of this circuit is its relatively low cost for the features provided. The 1-Wire timing is generated by hardware, which can reduce the initial software development time and cost. Consequently, the entire application software can be written in high-level language. The DS2482 supports a strong pullup as well as active pullup. Active pullup, however, is not needed for embedded applications. The built-in 1-bit search accelerator makes the 1-Wire ROM search easier to implement in software. On the downside, the DS2482 cannot drive as many 1-Wire slaves as the DS2490 or DS2480B. The DS2482 is also available in an 8-channel version. The single-channel versions, DS2482-100 and DS2482-101, have a control output for an additional strong pullup (Q1). In contrast to the DS2480B and DS2490, the duration of the active pullup is fixed on the DS2482. The value of the I²C pullup resistors depends on I²C bus size and population. For additional information refer to application note 3684, "How to Use the DS2482 I²C 1-Wire® Master," and the DS2482 data sheet. The source code of application note 3684 is available for download.

Figure 6. I²C interface with optional circuit for extra strong pullup (dashed lines).
Figure 6. I²C interface with optional circuit for extra strong pullup (dashed lines).

The 1-Wire master of Figure 7 has characteristics very similar to the DS2480B.

As the main prerequisite, this circuit requires a USB port, which is typically found with PCs. The upside of this circuit is that the 1-Wire timing is generated by hardware, which can reduce the initial software development time and cost. Consequently, the entire application software can be written in high-level language. Through control registers, the 1-Wire timing can be fine-tuned. The DS2490 supports a strong pullup and active pullup. Fine-tuning of the 1-Wire timing and active pullup are not needed for embedded applications, however. The built-in 4-bit search accelerator makes the 1-Wire ROM search easier to implement in software. On the downside, the DS2490 is more costly than the circuit shown in Figure 5 and it works with 5V only. As a 1-Wire master, the DS2490 is not as strong as the DS2480B. The active pullup lasts until a second threshold has been crossed. For additional information refer to the DS2490 data sheet. Examples of application software are found in the 1-Wire Public Domain Kit. Note that the DS2490 is not recommended for new designs.

Figure 7. 1-Wire master for a USB interface. This is a simplified schematic. For more details, please see the DS2490 data sheet.
Figure 7. 1-Wire master for a USB interface. This is a simplified schematic. For more details, please see the DS2490 data sheet.

PC-Ready Adapter Solutions

Since they do not require any software development by the user, PC attachments that function as a 1-Wire master are very convenient for evaluating 1-Wire devices and for prototyping. Besides the adapter, the 1-Wire devices to explore, and some off-the-shelf cabling, all the user needs is the evaluation software, such as the Java-based OneWireViewer which is available for free download. The 1-Wire port of PC-ready adapters is either shaped to accept one iButton® or a female RJ-11 connector. Table 1 shows the details.

When evaluating 1-Wire devices through the OneWireViewer, the presence or absence of the identification chip does not make any difference. However, when prototyping a 1-slave application, the identification chip requires the use of the Search ROM function instead of Read ROM. This makes the prototyping software slightly more complex than it otherwise needed to be.

Table 1. PC-Ready 1-Wire Adapters
Port Type Converter 1-Wire Port Part Number Notes
COM port, DB-9 DS2480B iButton DS1411-009 Built-in identification chip is hardwired to 1-Wire bus
DS1411-S09 No identification chip
RJ-11 DS9097U-009 Built-in identification chip is hardwired to 1-Wire bus
DS9097U-S09 No identification chip
COM port, DB-25 DS2480B RJ-11 DS9097U-E25 No identification chip; with external 12V supply, this adapter can program 1-Wire EPROMs
USB port DS2490 iButton DS9490B Built-in identification chip is hardwired to 1-Wire bus
RJ-11 DS9490R

Which Is the Right 1-Wire Master for My Application?

As preparation for the decision to this question, perform the following steps:
  1. Determine whether your application needs a strong pullup. See the "1-Wire Glossary" section above for guidance.
  2. Determine the 1-Wire operating voltage of your application. See the "1-Wire Glossary" section above for guidance.
  3. In the Decision Worksheet (Table 2), cross out the schematics (columns) for which the prerequisites are not available.
  4. In the Decision Worksheet, cross out the schematics (columns) that do not support the operating voltage of your application.
  5. If your application needs a strong pullup, fill in a YES in row 5, otherwise fill in NO.
For each of the remaining schematics, do the following:
  1. Estimate the cost of the additional hardware (based on items in row 3; include items in row 4, if row 5 contains a YES) and write the value in row 6. The additional port is assumed to be free, unless an upgrade to a larger microcontroller or FPGA/ASIC is needed. In the case of an upgrade, add the incremental cost for the microcontroller or FPGA/ASIC.
  2. Estimate the cost for the software development and divide it by the projected number of units to be built. Write the number into row 7. If the software development cost cannot be estimated, fill in a 0 or leave the field blank.
  3. Add the values from rows 6 and 7, and write the sum in row 8.
The schematic with the lowest cost in row 8 is your best choice.

Table 2. Decision Worksheet
Row # Title Schematic/Figure Number
1 2 3 4 5 6 7
1 Prerequisites One bidirectional port Two unidirectional ports 1-Wire port One bidirectional port One UART port One I²C port One USB port
2 1-Wire operating voltage 3V to 5V 3V to 5V 3V to 5V 3V to 5V 5V 3V to 5V 5V
3 Additional hardware for basic operation RPUP RPUP, Q1 RPUP RPUP DS2480B DS2482 DS2490, 12MHz crystal, 3V regulator, several Rs and Cs
4 Additional hardware for SPU One unidirectional port, Q1, R1 One unidirectional port, Q2, R1 Q1, R1 Q1, R1 (none) (none) (none)
5 SPU check box              
6 Estimated additional hardware cost              
7 Estimated software cost per unit              
8 Extra cost per unit (hardware and software)              

Conclusion

The right 1-Wire master for an embedded application is the one that meets the electrical requirements for the 1-Wire device(s) (i.e., operating voltage, strong pullup if needed) at the lowest possible additional cost. The final choice depends on the spare (unused) resources in the application, which can be port pins, UART, I²C bus, or even a USB port, and space in program memory. If the spare resources are insufficient, an upgrade to a microcontroller or FPGA with more ports and/or program memory may be necessary.

In the category of Serial Interface Protocol conversions, the DS2482-100 and DS2482-101 are the most cost-efficient choices. For applications with a large number of slave devices, the DS2482-800 has an even lower cost per 1-Wire channel. Although the circuits in the category of Microprocessor Port Pin Attachments cost considerably less than a DS2482, the additional efforts for software development (in particular if the "bit-banging" low-level driver needs to be written) can only amortize over a large number of units built. The Synthesizable 1-Wire Bus Master is an interesting solution for any FPGA-based application. If the general features of the DS80C4XX microcontrollers are a good match to the application's requirements, the additional components for utilizing the built-in 1-Wire master cost only pennies. Using the DS80C400, the 1-Wire timing is generated by hardware so the overhead in software development is minimal. Although suitable for embedded applications, the DS2480B and DS2490 are typically found in PC-ready port adapters.

1-Wire is a registered trademark of Maxim Integrated Products, Inc.

iButton is a registered trademark of Maxim Integrated Products, Inc.

Verilog is a registered trademark of Gateway Design Automation Corporation.



Related Parts
DS1411 Serial Port iButton Holder  
DS2480B Serial to 1-Wire Line Driver Free Samples  
DS2482-100 Single-Channel 1-Wire Master Free Samples  
DS2482-101 Single-Channel 1-Wire® Master with Sleep Mode Free Samples  
DS2482-800 8-Channel 1-Wire Master Free Samples  
DS2490 USB to 1-Wire Bridge Chip  
DS80C400 Network Microcontroller  
DS80C410 Network Microcontrollers with Ethernet and CAN  
DS80C411 Network Microcontrollers with Ethernet and CAN  
DS9097U Universal 1-Wire COM Port Adapter  
DS9490 USB to 1-Wire/iButton Adapter  


Next Steps
EE-Mail Subscribe to EE-Mail and receive automatic notice of new documents in your areas of interest.
Download Download, PDF Format (93kB)  
Share
Other Channels  Email this page to an associate or friend. 



APP 4206: Mar 27, 2008
REFERENCE SCHEMATIC 4206, AN4206, AN 4206, APP4206, Appnote4206, Appnote 4206

Share



More