The 1-Wire bus is a simple signal transmission circuit that allows half-duplex, bidirectional communication between a master controller and one or more slave devices over a common data line. Power and data communication are transmitted over a single data line, making 1-Wire devices extremely powerful and reducing the number of interconnects between systems. 1-Wire devices provide memory, mixed signal, and security authentication functions through a patented single-contact serial interface. Typical applications for 1-Wire devices are as follows: identification of print cartridges or medical consumables; calibration and control of rack cards; identification and authentication of printed circuit boards, accessories, and peripherals; intellectual property protection, anti-cloning, and security function control.
When using 1-Wire technology, a 1-Wire master is required to send signals to identify and communicate with devices on the bus. There are many ways to build a 1-Wire master. This article discusses masters for embedded applications, including small networks with a radius of no more than 1 meter and no more than three to five 1-Wire slaves. When designing large 1-Wire networks or with a large number of slaves, refer to application note 148: "Guidelines for Reliable Design of 1-Wire Networks."
1-Wire Terminology
Let's start by explaining a few common terms found in 1-Wire documentation.
Host Interface
The circuits discussed in this article are 1-Wire master controllers, which all communicate with 1-Wire slave devices. However, these 1-Wire master controllers cannot act as standalone entities and require a host (computer) to tell them how to act on the 1-Wire side. The host interface refers to the type of connection between the 1-Wire master controller and the "higher commander in the system" (the master).
Operating Voltage
Typically, the operating voltage of 1-Wire devices ranges from 2.8V (minimum) to 5.25V (maximum). Most 1-Wire devices do not have a power pin. Therefore, the device draws power from the 1-Wire communication line in a parasitic manner. Operating voltage and 1-Wire pull-up voltage are actually synonymous. The higher the operating (pull-up) voltage, the more power the 1-Wire device can get. The higher the voltage, the more 1-Wire slaves can be attached to the network and the faster the recovery time between time slots.
Strong pull-up
Strong pull-up refers to a method of providing additional power to the 1-Wire network between time slots. The following components require additional power: the EEPROM device (when copying data from the buffer to the EEPROM cell); the secure memory (when the SHA-1 engine is running); and the 1-Wire temperature sensor (during temperature conversion). Strong pullups are required when these 1-Wire devices are used with a 3V supply; strong pullups are optional when the same 1-Wire slave is in a 5V environment.
1-Wire Timing
The following describes the general form of the 1-Wire timing and reset/presence detect timing waveforms and how to generate them. The waveforms can be generated using special hardware (such as a chip with its own timing generator) or directly in software. The hardware method is easier for software developers but requires an additional chip. The software method saves hardware costs but may increase software development and testing costs if the selected microcontroller does not have software support. If the application software is written in a high-level language, special considerations need to be taken when using the software method. It is necessary to write the low-level functions that generate the timing slots and reset/presence detect timing in assembly language so that the number of clock cycles required to execute an instruction can be calculated. Most 1-Wire slaves can communicate at two speeds: standard speed and overdrive. Overdrive is about eight times faster than standard speed. All 1-Wire slaves support standard speed. All Class 2 to Class 4 masters (mentioned below)
support overdrive
. Whether a Class 1 master supports overdrive depends on the microcontroller's performance (clock rate, number of clock cycles per instruction cycle).
The 1-Wire bus or network with active pullups
is an open-drain environment with 0V (logic 0) as the active state. When idle, the bus is pulled up to the pullup voltage (resistive pullup) through a resistor. Therefore, the falling edge is sharp; the rising edge is quite gradual due to the resistor and parasitic power. Active pullups refer to a method of testing the rising edge and, if it has exceeded a specified threshold, bypassing the pullup resistor for a limited time through a low-impedance path. Small networks or networks with only one slave device generally do not require active pullups. With active pullups, the 1-Wire bus recharges much faster than with resistive pullups, so there is no need to extend the recovery time between time slots when supporting multiple 1-Wire slaves in the network. The various 1-Wire masters differ in the strength (impedance) of the bypass pullups and the method of controlling the active pullup time.
1-Wire Master Circuits
The various master circuits are discussed in detail below. The circuits are divided into four categories:
Microprocessor Ports - Pin Connections
Microcontrollers
with Built-in 1-Wire Masters Synthetic 1-Wire Bus Masters
Serial Interfaces Protocol Conversion
Each category describes one or more circuits. The schematic is given, the prerequisites are listed, the advantages and disadvantages are weighed, and precautions, reference documents and supporting software URLs are given.
Class 1. Microprocessor Port-Pin Connections
Figure 1 shows the most basic 1-Wire master.
The only prerequisites for the circuit are a spare bidirectional port and some space in program memory. The advantage of the circuit is that it has very little additional hardware cost, only one pullup resistor is required. The disadvantage is that the 1-Wire timing is generated in software, which increases the time and cost of initial software development. Depending on the number of 1-Wire slaves in the application and the 1-Wire pullup voltage, additional port pins may be required to implement strong pullups. The maximum operating voltage of the 1-Wire bus depends on the characteristics of the bidirectional port (preferably 5V tolerant). When multiple slaves are connected to the 1-Wire bus, the RPUP value should be lower. In that case, check whether VOLmax is compatible with the input characteristics of the 1-Wire slaves and the microprocessor port. High-speed communication mode requires a microprocessor with a high clock frequency and/or a low number of clocks per instruction cycle. For more information, see application note 3829, "Determining Recovery Time for Multi-Slave 1-Wire Networks" and application note 126, "Implementing 1-Wire Communication in Software." Application software examples are available in the 1-Wire Public Domain Kit. Figure 1. Bidirectional Port Pin with Optional Strong Pullup Circuit (dashed line) [page] Figure 2 shows another basic circuit similar to Figure 1. The prerequisites for the circuit in Figure 2 are two spare unidirectional ports, pulldown transistors, and some program memory space. The advantage of this circuit is that no bidirectional ports are required. The disadvantage is that the 1-Wire timing is generated in software, which increases the time and cost of initial software development. Depending on the 1-Wire slaves in the application and the 1-Wire pullup voltage, it may be necessary to provide a strong pullup on other port pins. The maximum operating voltage of the 1-Wire bus depends on the characteristics of the bidirectional port (preferably 5V tolerant). When multiple slaves are connected to the 1-Wire bus, the RPUP value should be lower. In this case, it should be checked whether VOLmax is compatible with the input characteristics of the 1-Wire slaves and the microprocessor port. High-speed communication requires a microprocessor with a higher clock rate and/or a lower number of clocks per instruction cycle. For more information, see application note 3829, "Determining Recovery Time for Multi-Slave 1-Wire Networks" and application note 126, "Implementing 1-Wire Communication in Software." Application software examples are available in the 1-Wire Public Domain Kit. Figure 2. Unidirectional Port Pins with Optional Strong Pullups (dashed lines) Class 2. Microcontrollers with Built-in 1-Wire Masters The circuit of Figure 3 is very similar to that of Figure 1, except for the type of microcontroller. The main prerequisites for the circuit of Figure 3 are a microcontroller with a built-in 1-Wire master, such as the DS80C400, DS80C410, or DS80C411, and some space for program memory. The advantage of the circuit is that the 1-Wire timing is generated in hardware, which reduces the time and cost of upfront software development. Therefore, the entire application software can be written in a high-level language. The ports of the DS80C400 series microcontrollers are 5V tolerant. The disadvantage is that only high-end microcontrollers have built-in 1-Wire masters. Depending on the 1-Wire slaves and 1-Wire pullup voltages in the application, other port pins may need to provide strong pullups. When there is more than one slave on the 1-Wire bus, the RPUP value should be lower. In this case, check that VOLmax is compatible with the input characteristics of the 1-Wire slaves and the microprocessor port. For more information, see application note 3829, "Determining Recovery Time for Multi-Slave 1-Wire Networks," application note 613, "Programming the DS80C400 with Keil C," and the DS80C400 data sheet. Application software examples are available in the 1-Wire Public Domain Kit. Figure 3. Microcontroller with built-in 1-Wire master and optional strong pullup circuit (dashed line) Category 3. Synthetic 1-Wire Bus Master (ASIC/FPGA) The circuit of Figure 4 is very similar to Figure 3. The difference is that the microcontroller and 1-Wire port are built into an ASIC or FPGA. The main prerequisites for the circuit of Figure 4 are an ASIC or FPGA with microcontroller capabilities, at least one free bidirectional port pin, 3470 unused gates, and some program memory space. The advantage of this circuit is that the 1-Wire timing is generated in hardware, which can reduce the time and cost of upfront software development. Therefore, the entire application software can be written in a high-level language. The disadvantage is that not all ASICs or FPGAs have 5V tolerant ports. The 1-Wire operating voltage depends on the port characteristics of the ASIC/FPGA. Some 2.5V FPGAs have 5V tolerant I/O ports, which is better than 3.3 FPGAs. Depending on the 1-Wire slave devices and the 1-Wire pull-up voltage in the application, other port pins may need to provide strong pull-ups. When multiple slave devices are connected to the 1-Wire bus, the RPUP value should be lower. In this case, it should be checked whether VOLmax is compatible with the input characteristics of the 1-Wire slave devices and the microprocessor port. For more information, see Application Note 119, "Embedding a 1-Wire Master," Application Note 120, "Communicating with a 1-Wire Master," Application Note 145, "Interfacing the Maxim 1-Wire Master (DS1WM) to an ARM7 Processor," Application Note 3829, "Determining Recovery Time in a Multi-Slave 1-Wire Network," and the DS1WM data sheet. To obtain 1-Wire Master Verilog/VHDL code, please submit a technical support request. Application software examples are available in Application Notes 120 and 145. Figure 4. ASIC/FPGA with optional strong pullup circuit (dashed line) Class 4. Serial Interface Protocol Conversion The circuit in Figure 5 requires only one additional device to build a fully functional 1-Wire master.
The main premise of the circuit in Figure 5 is that you need a way to control the UART, such as a microcontroller, FPGA, or PC serial port, and that you need some program memory space. The advantage of the circuit is that the 1-Wire timing is generated in hardware, which can reduce the time and cost of upfront software development. Therefore, the entire application software can be written in a high-level language. The 1-Wire timing can be fine-tuned through control registers. The DS2480B supports strong pullups and active pullups. Embedded applications do not require fine-tuning of 1-Wire timing and active pullups, but the built-in 4-bit search accelerator makes 1-Wire ROM searches easier to implement in software. On the downside, the DS2480B is more expensive than the discrete components in Figures 1 to 4. The DS2480B only operates from 5V. It is the most powerful single-chip 1-Wire master and is suitable for communicating with a large number of slave devices. The active pullup lasts until the second threshold is exceeded. The DS2480B can also program 1-Wire EPROM devices. For more information, see Application Note 192, "Using the DS2480B Serial Interface 1-Wire Line Driver," Application Note 4104, "Understanding and Configuring the DS2480B 1-Wire Timing," and the DS2480B data sheet. The source code for AN192 can be downloaded here. Figure 5. UART/RS-232 Interface [page] The circuit of Figure 6 is well suited for I2C bus applications. The main prerequisites for the circuit of Figure 6 are the need for an I2C bus controller, such as a microcontroller or FPGA/ASIC, and the need for a certain amount of program memory. The advantages of the circuit are that it is cost-effective. The 1-Wire timing is generated in hardware, which can reduce the time and cost of upfront software development. Therefore, the entire application software can be written in a high-level language. The DS2482 supports strong pullups as well as active pullups. However, active pullups are not required for embedded applications. The built-in 1-bit search accelerator makes 1-Wire ROM searches easier to implement in software. The disadvantage is that 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 DS2482-100 has a control output for adding a strong pullup (Q1). In contrast to the DS2480B and DS2490, the active pullup duration of the DS2482-100 is fixed. The value of the I2C pullup resistor depends on the length and distribution of the I?C bus. For more information, see Application Note 3*, "How to Use the DS2482 1-Wire Master with an Alternative I?C Interface," and the DS2482-100 and DS2482-800 data sheets. The source code for Application Note 3* can be downloaded here. Figure 6. I2C Interface with Optional Extra Strong Pullup (Dashed Line) The 1-Wire Master characteristics of Figure 7 are very similar to those of the DS2480B. The main premise of the Figure 7 circuit is the need for a USB port, which is commonly found in PCs. The advantage of the circuit is that the 1-Wire timing is generated in hardware, which reduces the time and cost of upfront software development. Therefore, the entire application software can be written in a high-level language. 1-Wire timing can be fine-tuned via control registers. The DS2490 supports both strong and active pullups. However, embedded applications do not require fine-tuning of 1-Wire timing and active pullups. A built-in 4-bit search accelerator makes 1-Wire ROM searches easier to implement in software. On the downside, the DS2490 is more expensive than the device in Figure 5 and operates at only 5V. As a 1-Wire master, the DS2490 is not as powerful as the DS2480B. The active pullup persists until the second threshold is exceeded. For more information, see application note 117, "DS2490 Universal Serial Bus Descriptors," and the DS2490 data sheet. Application software examples are available in the 1-Wire Public Domain Kit. Figure 7. 1-Wire master with USB interface. This simplified circuit is shown in the DS2490 data sheet . Adapter Solutions for PCs PC accessories that act as 1-Wire masters are very convenient for prototyping and evaluating 1-Wire devices because they do not require software to be developed by the user. In addition to the adapter, the 1-Wire device to be tested, and an off-the-shelf cable, all the user needs is evaluation software, such as the Java-based OneWireViewer, which can be downloaded for free. The PC adapter 1-Wire port is suitable for connecting either an iButton or a female RJ-11 connector. The specifics are listed in Table 1. When evaluating 1-Wire devices with the OneWireViewer, it makes no difference whether the identification chip is present or not. However, when modeling an application with 1 slave device, the identification chip requires the execution of a Search ROM command instead of a Read ROM command. This makes software prototyping more complicated. Table 1. 1-Wire Adapters for PCs Which 1-Wire Master is Right for My Application? To better answer this question, first determine the following: Determine if the application requires a strong pullup. See the "1-Wire Terminology" section. Determine the 1-Wire operating voltage in the application. See the "1-Wire Terminology" section. In the decision table (Table 2), delete the solution (column) for the prerequisite that cannot be provided. In the decision table, delete the solution (column) for the operating voltage that is not supported by the actual application. If the application requires strong pull-ups, write YES in row 5, otherwise write NO. For the remaining options after elimination, perform the following steps: Estimate the cost of additional hardware (based on the items in row 3; if there is a YES in row 5, also include the items in row 4) and fill in row 6. Assume that adding ports is completely free unless you need to upgrade to a larger microcontroller or FPGA/ASIC. When upgrading, the microcontroller or FPGA/ASIC adds marginal costs. Estimate software development costs and divide them equally by the number of units built. Fill in the data in row 7. If software development costs cannot be estimated, write 0 or leave it blank. Add the numbers in rows 6 and 7 and write the result in row 8. The lowest cost option in row 8 is the best choice. Table 2. Decision TableRow # Title Schematic/Figure Number
Conclusion
A 1-Wire master suitable for embedded applications should meet the electrical requirements of the 1-Wire devices (i.e., operating voltage and, if necessary, strong pullups) at the lowest possible additional cost. The final choice depends on the available (unused) resources in the application, including port pins, UARTs, I?C bus, and even USB ports, as well as program memory space. If the available resources are insufficient, it may be necessary to upgrade to a microcontroller or FPGA with more ports and/or program memory.
In terms of the type of serial interface protocol conversion, the DS2482-100 is the most cost-effective choice. For applications with a large number of slave devices, the DS2482-800 has a lower cost per 1-Wire channel. Although the cost of the microprocessor port pin attachment circuit is significantly lower than that of the DS2482-100, the additional effort in software development (especially if low-level drivers for "bit banging" need to be written) can only be amortized by the number of units built. For FPGA-based applications, a synthetic 1-Wire bus master is a worthy solution. If the other features of the DS80C4XX microcontroller are a good match for the application requirements, the additional components required to utilize the built-in 1-Wire master cost only a few cents. With the DS80C400, 1-Wire timing is generated in hardware, so software development costs are minimal. Although the DS2480B and DS2490 are suitable for embedded applications, they are usually used in PC port adapters.
Previous article:Transplantation and Optimization of uCOS-II Priority Task Scheduling on PowerPC
Next article:The transplantation scheme of Nucleus embedded program to Linux
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?
- BLE Primer: Understanding BLE from the perspective of air data transmission and reception (Part 1)
- It took two years for a 19-year-old boy to build a 32-bit Risc-V processor using 230 pure 74 logic chips!
- Carrier-less pulse position modulation UWB communication system
- The combined application of FPGA technology in the field of automotive electronics;
- TI C6000 Data Storage Processing and Performance Optimization
- Digital Modulation Series: How to Understand IQ?
- dsp28335 Ecap
- A problem with the reset circuit
- 【CH579M-R1】Tested the TCP_Server mode of the lower network port, and the program is completely official. Success
- MSP430's duty cycle adjustable PWM signal generator source program