mgineer Blog
Top

Just 1-Wire to Operate I2C/SPI Endpoints

March 3, 2022

Marco A. Ramirez Castro  By: Marco A. Ramirez Castro
 Associate MTS, Applications, Analog Devices


Can I2C and SPI endpoint devices be powered and controlled with just a single wire?

It is possible to deliver power and data to operate I2C and SPI endpoints, such as humidity or temperature sensors, with the use of a single wire connection and ground using Analog Devices' 1-Wire® technology. This technology offers a robust solution when working with IO constrained systems where there may be just one or a few pins available on the host. The DS28E18 is a great example of a bridge device that leverages 1-Wire to address a common set of system challenges like wiring limitations, communication distance, and protocol conversion.

This one wire interface technology is unique to Analog Devices and has been around since the 1980s. Power and data are delivered over a single dedicated connection enabling a wide range of applications such as local or remote environmental sensing, medical sensors, or accessory identification. The 1-Wire solution for these applications comes with the benefits of operating SPI or I2C devices with a single-contact interface, eliminating the need for an external power source, and the flexibility of 1-Wire and I2C/SPI master operational modes.

To operate this interface there's two contacts total, the 1-Wire single connection as well as a ground connection and with this we can communicate at two different speeds 11.7 kb/s and 62.5 kb/s in overdrive mode. Figure 1 demonstrates a very simple system level configuration and how the DS28E18 fits into the system. A microcontroller host (µC) is attached to a remote SPI sensor through a 1-Wire interface to the DS28E18 bridge using only two connections, the 1-Wire IO and ground.

System Level ConfigurationFigure 1. System Level Configuration

1-Wire to I2C/SPI with Sequencer and Power Harvesting

One of the unique features of the DS28E18 communications bridge is that it can harvest up to 10mAs of current to power up the externally connected I2C/SPI endpoints. This device is also capable of driving the I2C and SPI endpoints up to 1MHz and 2.3MHz, respectively. It comes in a small 2x3mm TDFN package and operates at 3.3V (±10%) within environmental conditions of -40°C to +85°C.

Besides the 1-Wire interface and capabilities, the DS28E18 has three main blocks that are essential to interface with the I2C/SPI endpoints; a command sequencer that serves as a bridge between 1-Wire commands and I2C/SPI commands, an SRAM block with data on it to ultimately operate the device, and a I2C/SPI/GPIO interface controller. This is all shown in Figure 2 below.

Block DiagramFigure 2. Block Diagram

The Command Sequencer

The Command Sequencer processes the buffer data and stores it at the specified address in SRAM (128 bytes at a time) and returns a CRC16 for the host processor to validate data transmission. The sequencer minimizes the host's communication overhead by having the most commonly used commands stored in the SRAM. The DS28E18 provides a 512-byte buffer in SRAM that can be loaded with multiple I2C or SPI commands. Once loaded, the host controller sends a command to execute the sequence, provide power, and collect data from attached I2C or SPI peripherals. A subsequent 1-Wire command reads collected sensor data.

There are three types of commands to operate this device which reside in the blue highlighted elements of Figure 3 shown below. They are the '1-Wire ROM Function Commands', the 'DS28E18 Device Function Commands', and the 'DS28E18 Sequencer Commands'.

Highlighted Block Diagram of where Commands ResideFigure 3. Highlighted Block Diagram of where Commands Reside

The host initiates communication to identify and select the DS28E18 bridge device using 1-Wire ROM level function commands. Once selected, device function commands are used to interact with the sequencer. Figure 4 lists the 1-Wire ROM and device function commands available for the DS28E18. Refer to the DS28E18 Technical Documentation for detailed information.

The DS28E18 has a 144-byte command buffer that utilizes 16-bytes for device function command operations and 128-bytes to transfer formed packets with sequential commands into a 512-byte SRAM sequencer. The formed packets installed in the SRAM sequencer can be called to write and/or read I2C/SPI data to attached slaves. The maximum length of a sequence is 512 bytes. Upon completion of a sequence, the I2C/SPI slave response is recovered using a Read sequencer command.

The result byte returned indicates success or any error encountered, such as receiving a NACK. If the result byte indicates an error, two additional bytes are returned indicating the position of error in the sequence.

The sequencer's utility commands provide various functions such as delays and power gating to an endpoint device via the SENS_VDD pin. The delay can be used in a sequence to allow additional time for an I2C/SPI endpoint device to perform a conversion or to allow for settling after power is applied to the endpoint. The delay ranges from 1ms to 32s. The power provided to the endpoint is harvested from the 1-Wire interface, so a strong pullup must be enabled by the host for the entirety of the sequence. The DS28E18 can deliver up to 10mA of current.

Figure 4 shows a list of the different commands and their level on the command hierarchy.

Command HierarchyFigure 4. Command Hierarchy

Interface control

The DS28E18's GPIOs, I2C and SPI interfaces are multiplexed across four pins, shown in Figure 5. The I2C interface can be configured to operate at 100kHz, 400kHz or 1MHz and SPI can be configured to operate at 100kHz, 400kHz, 1MHz or 2.3MHz. The GPIOs are not available when configured as SPI.

Figure 5. GPIO/I2C/SPI Pin Multiplexing and Interface Control

For a hands-on experience, order the DS28E18 Evaluation Kit or visit www.maximintegrated.com for more information on our wide range of electronic solutions.