Diodes Incorporated
Back to 技術文章

Three Reasons Your Design Needs I²C I/O Expanders

The 2-wire I²C bus is an incredibly useful way to add all kinds of low-speed I/O besides I²C while simplifying designs and trace routing.

The venerable I²C 2-wire bus remains as popular today as when Philips invented it in 1982. Originally a 100KHz bus, the current Version 4 (2014) Ultra Fast-mode (UFm) clocks at 5MHz—making it fast enough for most medium speed peripherals including digital I/O, GPIO, keyboards, keypads, and sensors. In fact, I²C is the perfect way to move signals around in many embedded systems, including those inside smartphones or destined to live on the “cloud edge” of the Internet of Things (IoT).

In this article we’ll suggest multiple examples where I²C will add value to your embedded design, giving you a new trick in your design tool bag.

2 Wires; Too Easy

I²C’s multi-drop, 3.3V or 5.0V active low, 2-wire interface is dirt-simple to wire up and easy to program. Using Serial Data Line (SDA) and Serial Clock Line (SCL), a master controls the bus and slaves acknowledge their 7- or 10-bit address (Figure 1). Communication ensues and the master ends the transmission with a stop bit. There can be several masters, and the number of slaves is limited only by the available addresses and bus capacitance.

Typical I²C bus length is on the order of several meters—more than enough for on-board or board-to-board system communications. Most I²C lines remain on a single PCB. The I²C protocol is a combination of START and STOP bits typically enumerated by dropping lines from high to low, with high typically at 5VDC.

Figure1
Figure 1: I²C uses a Master/Slave, 2-wire bus with pull-ups to an active high state. Addressing is either 7- or 10-bits, and there can be multiple masters and as many slaves as the addressing or bus capacitance allows. (Image courtesy of Wikipedia and created by Cburnett.)

With an available 5.0 volts and two easy-to-route lines, I²C can be converted to many other kinds of medium-speed interfaces such as GPIO, A/D/A, level shifters and countless IoT sensors (Figure 2). This means that many devices and interfaces can be MUXed, converted and transported via I²C. For example, a wide parallel interface can be reduced to I²C, reducing routing complexity by saving wires and traces.

I2C System Fig 2Figure 2: I²C can be used to convert from sensors and medium-speed interfaces. (Courtesy: Diodes Incorporated.)

I²C Simplifies Pinout, Fanout

Equally important is saving I/O pins on SoCs. All of the devices shown in Figure 2 can be implemented using only two SoC pins. That’s more than 13 devices connected to a space-constrained SoC with only two pins; amazing! For example, refer back to Figure 2 (lower right section), which shows I²C bridging to a SPI bus or a UART—all using only two I²C pins.

Figure 3 shows bi-directional I²C MUXes used to run multi-trace signals or busses over a longer distance using only two wires. I²C is fast enough to accommodate this kind of arrangement and it makes the job easy. For example, converting from a wide parallel bus to I²C saves on PCB routing, allows cheaper (and simpler) connectors, and can even act as a bus extender between boards in a system.
I2C Parallel Bus Fig3Figure 3: Using I²C to extend and/or simplify a parallel bus. (Courtesy: Diodes Incorporated.).

Figure 4 shows an I/O expander that converts an I²C bus to a 16-bit parallel bus. Compliant to the I²C spec, PI4IOE5V9539 from Diodes Incorporated supports active low signals, 400KHz Fast Mode operation for dual-simplex (all Input or all Output) GPIO operation, and can be clocked up to 2MHz if needed. This particular device can be ganged up to three others to create a 48-bit parallel bus that necks down to a 2-wire I²C interface (using four I²C slaves). According to Diodes', this is equivalent to a 48-wire keypad controller converted to two I²C wires using only four 24-pin, tiny TSOP parallel I/O expanders.

BLock Diag PI4IOE5V9539 Fig4Figure 4: Block diagram for a 16-bit I²C-to-GPIO expander. Up to four devices can be ganged to create a 48-bit parallel bus—perfect for high-function keypads. (Courtesy: Diodes Incorporated.)

Don’t Wake Me

Another reason I²C I/O expanders are so useful is they add local line control while freeing up the system controller from low-level tasks. In the simplified cell phone shown in Figure 5, the Baseband/Application Engine can avoid constantly polling the I/O blocks shown, burning battery power to keep the controller active. Instead, the INT (interrupt) output line can wake up the controller only when needed, allowing it to stay in standby or sleep, and save system power. A simple thing, but essential in battery-operated devices. In Pericom’s devices, this is called “Quick Link.”

The I/O expander shown back in Figure 4 also includes RESET. RESET sets the power-on default values without cycling the device power—a handy feature to return a still-powered system to a known good state. As well, the device offers the ability to switch polarity to either Input or Output, making a single device bi-directionally useful.

Figure 5: The expander’s interrupt line (INT) allows the Application Engine to avoid polling peripherals to stay in idle or sleep mode longer. (Courtesy: Pericom Semiconductor.)

Figure 5: The expander’s interrupt line (INT) allows the Application Engine to avoid polling peripherals to stay in idle or sleep mode longer. (Courtesy: Diodes Incorporated.)

Little Tricks to Simplify Designs

I²C I/O expanders simplify system designs in other, less obvious ways. Diodes' I/O expander product line includes fanout in x2, x4, x8 and x16 flavors and incorporates some nifty second-order features. For instance, a 2.2V to 5.5V Vcc range gives designers voltage choice from typical TTL 5.0VDC, down to the lower voltages found in battery and mobile devices.

I²C is a simple and robust 2-wire interface, but with longer traces comes the possibility of noise. Adding noise filtering on the I²C SCL and SDA lines avoids false level changes. Some I/O expanders also support both TTL and CMOS voltage levels on the I²C lines, a convenience for legacy designs.

The PI4IOE5V9570 4-bit I/O expander shown in Figure 6 can also drive LEDs directly. It’s a faster device capable of 1MHz I²C operation, but each of its four latched outputs can source 25mA. In this case, the SoC controls the GPIO signals using the I²C interface (through the bridging function in the expander). The SoC issues I²>C commands to the expander, which in turn converts the commands to either high or low voltage. The GPIO ports drive the LEDs directly and the conversion from I²C to GPIO and proper LED voltage is taken care of completely by the I/O expander. In a system design like a cell phone, this means two I²C wires can illuminate and control four separate LEDs.

Block Diag PI4IOE5V9570 Fig6

Figure 6: This 4-bit I²C I/O expander has two additional tricks: 1MHz operation and 25mA drive on each output pin—enough to drive LEDs directly. (Courtesy: Diodes Incorporated.)

From Two, to Too Many to Count

In this article we’ve described only a handful of ways I²C I/O expanders benefit embedded designs. From fan out/in, to saving SoC power and pins, to driving LEDs directly, the I²C I/O expander adds some simple elegance to the mature I²C bus. Better yet, the ways to use I²C expanders are too many to count. We encourage you to try one in your next design.