Keywords: 1-Wire, master, embedded security, host interface, operating voltage, strong pullup, 1-Wire timing, overdrive, microcontroller, FPGA, ASIC, sha256, sha3, ecdsa, cryptography, authentication, i2c, coprocessor
Choosing the Right 1-Wire® Master for Embedded Applications
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 (PCBs), accessories, and peripherals; 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 necessary 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 have no more than three to five 1-Wire slaves). For designs using 1-Wire for long lines or with a larger number of slaves, see Maxim application note 148, "Guidelines for Reliable Long Line 1-Wire® Networks."
The 1-Wire masters described in this application note are compatible with 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. Maxim application note 4477, "Reference Design of a 1-Wire® Bidirectional Voltage - Level Translator for 1.8V to 5V," presents such a circuit. R4 in application note 4477 corresponds to RPUP in this application note.
There are several terms commonly found in 1-Wire documents that should be explained at the outset.
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 standalone entities. They need a host microcontroller that tells them what to do on the 1-Wire side.
Typically, 1-Wire devices function over the following voltage ranges:
Most 1-Wire devices have no pin for a 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.
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 the EEPROM devices, such as when copying data from a buffer to EEPROM cells, for secure memories when the SHA-256/SHA-3 engine is running, or for 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 Maxim application note 4255, "How to Power the Extended Features of 1-Wire® Devices."
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.
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 masters discussed in Categories 2 and 3 (see the discussion in the 1-Wire Master Circuits section) support overdrive. In Category 1, the overdrive support depends on the capabilities of the microcontroller (e.g., clock rate, number of clock cycles per instruction cycle).
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.
This section discusses the various master circuits in detail. The circuits are grouped into three categories:
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. Creating a Master using a Microprocessor Port-Pin
Figure 1 below shows the most basic implementation of a 1-Wire master.
Figure 1. Unidirectional port pins with optional circuit for strong pullup (dashed lines).
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 low hardware cost. 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. 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, see Maxim 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 shows another basic circuit similar to Figure 1.
Figure 2. Bidirectional port pin with optional circuit for strong pullup (dashed lines).
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. 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 Maxim 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.
Category 2. Synthesizable 1-Wire Bus Master (ASIC/FPGA)
The circuit in Figure 3 is very similar to that in Figure 1. The difference is that the microcontroller and 1-Wire port are embedded in an ASIC or FPGA.
Figure 3. ASIC/FPGA with optional circuit for strong pullup (dashed lines).
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. In this circuit, 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 1-Wire operating voltage is limited by the port characteristics of the ASIC/FPGA. 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, see Maxim application notes 119, "Embedding the 1-Wire® Master in FPGAs or ASICs," 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 Maxim application note 5507, “Understanding the DS1WM Synthesizable 1-Wire Bus Master,” for a description of the DS1WM core. To obtain the 1-Wire master Verilog®/VHDL code, submit a tech support request. Examples of application software are included in the aforementioned application note 145.
Category 3. Maxim’s Hardware 1-Wire Masters
Maxim provides a wide range of 1-Wire master products that can be used to reliably drive a network of 1-Wire slave devices. In this section, we investigate a few of these 1-Wire master products.
The circuit in Figure 4 shows how to add the DS2480 full-featured 1-Wire master to a design.
Figure 4. UART/RS -232 interface.
As the main prerequisite, this circuit requires a way to control a UART, such as a microcontroller, FPGA, or PC serial port, as well as some spare space in the program memory. In this circuit, 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 an active pullup. However, fine-tuning of the 1-Wire timing and the active pullup is not needed for embedded applications.
The built-in 4-bit search accelerator makes the 1-Wire ROM search easier to implement in software. The DS2480B works with 5V only. The active pullup lasts until a second threshold has been crossed. The DS2480B can also program 1-Wire EPROM devices.
For additional information, see Maxim application notes 192, "Using the DS2480B Serial 1-Wire Line Driver," and 4104, "Understanding and Configuring the 1-Wire Timing of the DS2480B," as well as the DS2480B data sheet. The source code in application note 192 is available for download.
The circuit in Figure 5 is most convenient for applications that already use an I2C bus.
Figure 5. DS2484 connected to a host microcontroller I2C port.
As its main prerequisite, this circuit requires an I2C bus controller, such as a microcontroller or FPGA/ASIC, and some spare space in the program memory. This circuit has a 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 DS2484 supports a strong pullup as well as active pullup and can drive numerous 1-Wire slaves connected to the 1-Wire bus. The built-in 1-Wire Triplet command makes the 1-Wire ROM search easier to implement in software. The value of the I2C pullup resistors depends on I2C bus size and population.
The DS2484 is software compatible with the older DS2482. For additional information on related software development, see Maxim application note 3684, "How to Use the DS2482 I2C 1-Wire® Master."
The circuit in Figure 6 shows the application circuit for the DS2477. It is the most powerful, flexible, and easy-to-use I2C to 1-Wire master product that Maxim offers currently. The DS2477 also has built-in SHA-3 engine for cryptographic authentication along with 2Kb of ChipDNATM-protected EEPROM for user data and key storage. For additional information on using the DS2477 with a SHA-3 enabled authenticator, see Maxim application note 6896, "Why Now is a Good Time to Secure Your Embedded Systems with SHA-3."
Figure 6. DS2477 connected to a host microcontroller I2C port with DS28E50 slaves.
Although optimized to be used with SHA-3 enabled 1-Wire slaves, it can also work very well with all 3.3V 1-Wire slaves, including the SHA-256 or ECDSA-based authenticators. This configuration is shown in Figure 7. The GPIO pin can be used to switch in an application specific external pullup or other control features.
Figure 7. DS2477 connected to other 1-Wire slaves.
The main prerequisite for developing a DS2477-based system is to have an I2C bus controller, such as a microcontroller or FPGA/ASIC, and some spare space in the program memory. For a relatively low cost, the DS2477 provides a set of exceptional features that makes the development fast, secure, and robust. Just as with the DS2484, 1-Wire timing is generated by hardware, which can reduce the initial software development time and cost. Thus, the entire application software can be written in high-level language.
All of the 1-Wire timing parameters are configurable in the DS2477. Thus, a wide range of 1-Wire slaves are supported. The device supports both standard and overdrive speeds. The DS2477 supports a strong pullup as well as active pullup and selectable internal pullup values. In lab tests, the DS2477 was able to successfully drive 50 DS1990 iButtons over 1000 feet using a 333Ω pullup resistor setting. With the built-in flexible settings, not only embedded applications, but a variety of distance and fan-out combinations, will work with the DS2477.
Since they do not require any software development by the user, PC attachments that function as a 1-Wire masters and the device-specific evaluation kits (EV kits) are very convenient for evaluating 1-Wire devices and for prototyping.
For the adapter-based solution, 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 EV kits are more convenient than using a standalone adapter as they contain everything that is needed to carry out the prototyping and exploration. The evaluation kits also include a USB-to-I2C or USB-to-I2C/1-Wire adapter.
In addition to the free evaluation software included with the EV kits, C-based free demonstration code examples are also available from Maxim upon request. Table 1 shows the details of some available evaluation platforms.
Table 1. PC-Based Adapters and EV Kits
|Port Type||Adapter/Kit Part Number||1-Wire Master Supported||Notes|
|USB||DS9481R-3C7+||DS2480B||For iButton evaluation use: DS1402D-DR8 cable or DS1402D-DR8+ Blue Dot™ receptor|
For other 1-Wire devices use: DS9120 socket boards
|USB||DS2484EVKIT#||DS2484||Contains: DS2484 evaluation board, DS9400 USB-to-I2C adapter, USB cable|
|USB||DS28E50VKIT#||DS2477||Contains: 5 each of DS2477 and DS28E50 in TDFN package, 2 DS9120BQ+ evaluation boards, and 1 DS9481P-300 USB-to-I2C/1-Wire adapter|
Table 2 gives a snapshot of the various approaches towards implementing a 1-Wire master. This table can be used to determine the best approach depending on the application and development requirements.
For example: A 3.3V printer cartridge identification application requires a 1-Wire master that needs to drive 4, 1-Wire authenticators installed in cartridges that are on the 1-Wire bus. It also needs to function as a coprocessor to authenticate the cartridges when they get attached or powered up. In this case, if there is an I2C port available on the host microcontroller, the DS2477 can be used with ease.
Table 2. 1-Wire Master Selection Decision Matrix
|Row #||Title||Schematics/Figure Number|
|1||Prerequisites||One available bidirectional port||Two available unidirectional ports||One available bidirectional port||One available UART port||One available I2C port||One available I2C port|
|2||1-Wire operating voltage||1.8V to 5V||3V to 5V||3V to 5V||5V||3V to 5V||3V|
|3||Additional hardware for basic operation||RPUP||RPUP, Q1||RPUP||DS2480B||DS2484||DS2477|
|4||Additional hardware for SPU||One available unidirectional port, Q1, R1||One available unidirectional port, Q2, R1||Q1, R1||Built-in||Built-in||Built-in|
|5||Ease of development||SW development for 1-Wire master required||SW development for 1-Wire master required||HW(HDL) development for 1-Wire master required||Built in 1-Wire master, no HW or SW development needed||Built in 1-Wire master, no HW or SW development needed||Built in 1-Wire master, no HW or SW development needed|
|6||Time to market||Long||Long||Long||Short||Short||Short|
|7||Security feature||None||None||None||None||None||ChipDNA physically unclonable function (PUF)|
|8||Built-in authentication||No||No||No||No||No||Yes, SHA-3 symmetric key algorithm|
|9||Additional features||None||None||None||RS-232/UART-to-1-Wire protocol converter||I2C-to-1-Wire protocol converter||I2C-to-1-Wire protocol converter, 2Kb of secure memory for user data and key storage, control port|
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 a reasonable cost but provides the best overall functionality. The final choice depends on the spare (unused) resources in the application, which can be port pins, a UART or I2C bus, and space in program memory. Currently the DS2477 is most versatile 1-Wire master available in the market at a very reasonable cost. It is immensely feature-rich and programable to support any and all 1-Wire systems including the ones with high security requirements.
|DS2477||DeepCover Secure SHA-3 Coprocessor with ChipDNA PUF Protection||Samples|
|DS2480B||Serial to 1-Wire Line Driver||Samples|
|DS2482-100||Single-Channel 1-Wire Master||Samples|
|DS2484||Single-Channel 1-Wire Master with Adjustable Timing and Sleep Mode||Samples|
|EE-Mail||Subscribe to EE-Mail and receive automatic notice of new documents in your areas of interest.|
|Download||Download, PDF Format (300kB)|
|© Mar 27, 2008, Maxim Integrated Products, Inc.|
APP 4206: Mar 27, 2008
REFERENCE SCHEMATIC 4206, AN4206, AN 4206, APP4206, Appnote4206, Appnote 4206