EE Primers · Communication interfaces · Driver Topologies · 2 of 9

Tri-state outputs: push-pull that can let go

A tri-state output is a push-pull stage with an enable. Enabled, it drives high or low exactly like push-pull. Disabled, both transistors are off and the pin presents only leakage and capacitance: the high-impedance state, Z. That third state is what lets several devices share one wire by taking turns. It also creates the two problems this page is about: what voltage the wire has when nobody drives it, and what happens in the nanoseconds when one driver lets go and the next takes over.

How it works, step by step

  1. Start from push-pull. The same PMOS to VDD and NMOS to ground, with the pin between them.
  2. Give each gate its own enable. Logic in front of the pair lets the enable force the PMOS gate high and the NMOS gate low, whatever the data input is.
  3. Enabled: an ordinary output. With EN = 1 both gates follow the inverted input, and the pin drives high or low with full push-pull strength.
  4. Disabled: both switches off. With EN = 0 neither transistor conducts. The pin is left with leakage (microamps at worst), a few picofarads of capacitance, and the ESD diodes to each rail. That is the high-impedance state, Z.
  5. Share a wire by taking turns. Several tri-state outputs can sit on one wire as long as at most one is enabled at a time. The protocol, not the circuit, guarantees that.
  6. A wire nobody drives drifts. With every driver off, leakage and coupling set the voltage. If it settles mid-rail, a CMOS input on the wire turns both of its transistors partly on and draws current. A pull resistor or a bus keeper gives the idle wire a defined level.
  7. The handover is the risky moment. Disabling one driver and enabling the next each take nanoseconds. If the new driver turns on before the old one has let go, both drive at once and fight, so designs leave a turnaround gap between them.
01 · Intuition

A third position on the switch

Think of the push-pull output as a two-position switch: up to VDD or down to ground. Tri-state adds a centre position connected to nothing. In silicon that is done in the pre-driver: the enable signal gates the two transistor drives separately, so that when EN = 0 the PMOS gate is forced high (PMOS off) and the NMOS gate is forced low (NMOS off), regardless of the data input.

$$\text{PMOS gate}=\text{NAND}(\text{IN},\ \text{EN})\qquad \text{NMOS gate}=\text{AND}(\text{NOT IN},\ \text{EN})=\text{NOR}(\text{IN},\ \text{NOT EN})$$

With EN = 1 these reduce to NOT IN for both gates, which is an ordinary inverter driving the pair, and the output follows IN. With EN = 0 the PMOS gate is 1 and the NMOS gate is 0: both off.

Gate logic in front of the output pair. The enable acts on both gate drives independently, so "off" means both devices off at once.
ENINPMOS gateNMOS gatePMOSNMOSPin
1011offon0 (driven)
1100onoff1 (driven)
0x10offoffZ (released)
Every bidirectional pin is tri-stateA GPIO configured as an input is a tri-state output with EN = 0 and the input buffer listening. Changing direction in firmware is toggling EN. The output enable is often active low on discrete parts: OE#, G̅.
02 · What Z really is

High impedance is not infinite impedance

A disabled output still has three things attached to the pin:

  • Leakage current IOZ. Junction and subthreshold leakage of the off transistors. Typical values are tens of nanoamps at room temperature; datasheets guarantee ±1 to ±10 µA over temperature, because leakage roughly doubles every 10 °C.
  • Output capacitance Cout. Drain junctions, pad and ESD structures: 3–8 pF per pin for logic, more for big FPGA I/O. It does not go away when the driver is disabled, so every device on a shared bus loads it.
  • The ESD diodes. "High-Z" holds only between the rails. Drive the pin above VDD + 0.5 V or below −0.5 V and the clamp diodes conduct. A disabled 3.3 V output on a bus pulled up to 5 V is not high impedance; it clamps the bus to about 3.9 V and sinks current into its own supply.

So the equivalent of a disabled output is a current source of up to IOZ (either sign) in parallel with Cout, bounded by two diodes. Expressed as a resistance, \(3.3\ \text{V}/10\ \text{µA}=330\ \text{k}\Omega\) worst case, typically tens of MΩ.

What a disabled output looks like from the bus.
03 · The floating bus

What voltage is a wire nobody is driving?

When every driver is disabled, the bus is a capacitor with nothing defining its charge except leakage and coupling. Two mechanisms move it.

Drift from leakage

The net leakage of all pins (some source, some sink, they do not cancel reliably) charges the bus capacitance:

$$\text{d}V/\text{d}t=\Sigma I_{\text{leak}}/C_{\text{bus}}$$

Worked example. A net leakage of 5 µA into a 30 pF bus moves it at 0.17 V/µs. Released from 0 V, it reaches the 0.8 V VIL of an LVTTL input in under 5 µs and sits in the undefined region from then on. At room temperature with 50 nA of leakage it takes half a millisecond, which is why a floating-bus bug can pass on the bench and fail in the climatic chamber.

Coupling from neighbours

An undriven node is a capacitive divider. Every edge on an adjacent trace with mutual capacitance Cc moves it by

$$\Delta V=\Delta V_{\text{agg}}\cdot C_{\text{c}}/(C_{\text{c}}+C_{\text{bus}})$$

A 3.3 V aggressor with 1 pF of coupling into a 20 pF floating bus moves it 157 mV per edge, and nothing restores it between edges. A floating chip-select or interrupt line can be walked across the threshold by a neighbouring clock.

A bus at mid-rail is not merely an unknown logic value. Every CMOS input on it has both input transistors partly on and draws crowbar current (hundreds of µA to a few mA each, see push-pull power), and noise near the threshold makes those inputs toggle, which wakes up logic behind them.

Symptom listSleep current several mA too high; an interrupt that fires on its own when a nearby bus is active; a peripheral that powers up in a random mode because its strap or chip-select pin floated; a "stuck" bus read that returns the last value written (the bus capacitance remembered it).
04 · Defining the idle level

Pull resistors and bus keepers

Pull resistor sizing

A resistor from the bus to a rail sets the idle level. Two bounds apply.

Upper bound (leakage). With N devices each leaking up to IOZ, plus input currents IIH, the pull-up must hold the bus above VIH with margin:

$$R_{\max}=(V_{\text{DD}}-V_{\text{IH}}-\text{margin})/(N\cdot I_{\text{OZ}}+\Sigma I_{\text{IH}})$$

With 8 devices at 10 µA worst case, 3.3 V, \(V_{\text{IH}}=2.0\ \text{V}\) and 0.3 V margin: \(R_{\max}=1.0\ \text{V}/80\ \text{µA}=12.5\ \text{k}\Omega\). With realistic leakage (1 µA each) 100 kΩ would do; designs typically use 10–47 kΩ.

Lower bound (power and drive). Whenever a driver holds the bus at the opposite level it carries the pull current, VDD/R, which also costs static power VDD²/R. At 10 kΩ that is 0.33 mA and 1.1 mW per line while low, small for a GPIO, significant for a 32-bit bus held low in sleep.

The pull-up is not what defines the level during turnaround

After release the bus relaxes toward the pull rail with time constant RCbus:

$$t_{\text{valid}}=RC_{\text{bus}}\cdot \ln [V_{\text{DD}}/(V_{\text{DD}}-V_{\text{IH}})]\qquad 10\ \text{k}\Omega \times 30\ \text{pF}\times \ln (3.3/1.3)=0.28\ \text{µs}$$

That is hundreds of nanoseconds, far longer than a bus cycle. A pull resistor guarantees the level during long idle periods, reset and sleep. It does not make a bus that is released and immediately sampled read high.

Bus keeper (bus hold)

A bus keeper is a weak latch on the pin: two back-to-back inverters where the feedback inverter is deliberately feeble. It remembers whatever level was last driven and holds it after the driver releases. Because it holds the bus at a rail, nothing draws crowbar current, and unlike a pull-up it costs no static current at either level. The cost is that every driver must overpower it to change the level. Logic families specify a sustaining current (e.g. ±75 µA at the threshold edges, meaning the keeper holds against that much leakage) and an overdrive current (e.g. ±500 µA, the current a driver must supply to flip it). Most FPGAs offer pull-up, pull-down and keeper as per-pin options.

Pull-up / pull-down
  • Known level in reset and when unpowered upstream
  • Static current while driven to the opposite level
  • Choose the level the system should see if all drivers are off (CS̅ high, IRQ̅ inactive)
Bus keeper
  • No static current at either level
  • Holds the last value; undefined level at power-up
  • Cannot pull a wire that was never driven; do not use where the reset level matters
Nothing
  • Acceptable only if the bus is always driven, or every receiver ignores it while idle and is not a plain CMOS input
  • A frequent cause of sleep-current and EMC failures
05 · Turnaround

Handing the bus over: enable and disable times

Disabling an output does not happen instantly, and neither does enabling one. Datasheets give four times, measured from the enable edge:

  • tPZH, tPZL (enable): Z to driven high or low.
  • tPHZ, tPLZ (disable): driven high or low to Z. Measured as the time for the output to move a few hundred millivolts with a test load, because a released bus does not go anywhere by itself.

When driver A hands over to driver B, the bus is safe only if A is off before B turns on. If B's enable is issued a gap tgap after A's disable is issued, the overlap is

$$t_{\text{overlap}}=t_{\text{dis},\text{A},\max}-(t_{\text{gap}}+t_{\text{en},\text{B},\min})\qquad (\text{no contention if}\le 0)$$

During the overlap the two drivers fight as in push-pull contention (only on the bits where A and B disagree). The energy per fighting bit is

$$E=V_{\text{DD}}\cdot I_{\text{cont}}\cdot t_{\text{overlap}}$$

Worked example. An asynchronous SRAM read followed by a processor write on a 32-bit bus. The SRAM's output-disable time tHZOE is up to 8 ns; the processor starts driving write data 0 ns after deasserting OE# and its own enable takes 2 ns minimum. Overlap 6 ns. At 50 mA per fighting bit, with 16 bits disagreeing on average: \(16\times 3.3\ \text{V}\times 50\ \text{mA}\times 6\ \text{ns}=16\ \text{nJ}\) per turnaround. At 5 million turnarounds per second that is 80 mW of pure contention, plus a \(16\times 50\ \text{mA}=800\ \text{mA}\) current spike through the I/O ground every time. Memory controllers therefore insert one or more idle turnaround cycles on every read-to-write change, and the timing configuration of an external memory interface is mostly about making these gaps exceed the worst-case disable time.

Bus handover. Top: enables. Bottom: the bus. Hatched: both drivers on (contention). The Z interval between drivers is where pull resistors or keepers matter.
06 · Loading

Every device on the bus slows it down

A disabled driver contributes its Cout plus its input buffer's Cin. On a short bus (lumped) the active driver sees the sum:

$$C_{\text{bus}}=C_{\text{trace}}+\Sigma (C_{\text{out}}+C_{\text{in}})\qquad t_{\text{r}}\approx 2.2\,R_{\text{out}}C_{\text{bus}}$$

Eight devices at 8 pF on 15 pF of trace is 79 pF; a 30 Ω driver gives \(t_{\text{r}}\approx 5.2\ \text{ns}\). A point-to-point link with the same driver would be well under a nanosecond.

On a long bus the loads are distributed along a transmission line. Spreading capacitance Cd per unit length on a line of intrinsic L0, C0 per unit length lowers its impedance and slows it:

$$Z'=Z_{0}/\sqrt{1+C_{\text{d}}/C_{0}}\qquad t_{\text{pd}}'=t_{\text{pd}}\cdot \sqrt{1+C_{\text{d}}/C_{0}}$$

A 50 Ω microstrip has about 3.3 pF/in. Loads of 8 pF every inch add \(C_{\text{d}}=8\ \text{pF}/\text{in}\), so \(Z'=50/\sqrt{3.4}=27\ \Omega\) and the delay grows 1.85×. A push-pull driver now has to drive 27 Ω, and a terminator that matched 50 Ω no longer matches. This is why wide parallel buses with many loads (classic SDRAM, PCI, VME) were limited to tens of MHz, and why everything faster went to point-to-point links.

07 · In practice

Where tri-state is used

InterfaceWho drives whenWhat to watch
SPI MISOOnly the peripheral whose CS̅ is low; the others are ZSome peripherals do not release MISO when deselected (or not until their first clock); isolate them with a buffer whose OE̅ is CS̅. Pull MISO up or down so it does not float between transactions. A peripheral powered off while others are active can clamp MISO through its ESD diodes.
Parallel SRAM / NOR flash / external memory busMemory on reads (OE̅ low), controller on writesRead-to-write turnaround versus tHZOE/tHZCE; bus capacitance with many devices; keepers or pulls for the idle data bus.
JTAG TDODevice drives only while shifting (Shift-DR/IR)Weak pull-up on TDO at the probe; daisy chains have one TDO per device, not a shared bus.
I²S / TDM shared dataSeveral ADCs each drive in their own time slotSlot-to-slot handover is a turnaround: drivers release on one bit-clock edge and the next drives on the following; check tdis against half a bit clock.
Bidirectional GPIO, MDIO (PHY side)Firmware or protocol selects directionBoth sides as outputs at the same time after a reset or a firmware bug: add series resistance.
RS-485 half duplexThe node that holds DE (driver enable) highThe differential version of the same problem, with fail-safe biasing instead of a pull-up: see differential push-pull.
08 · Self-check

Questions

A tri-state bus has a 47 kΩ pull-up and 40 pF. A controller releases it and samples 50 ns later. What does it read?

\(\tau =1.9\ \text{µs}\), so after 50 ns the bus has moved only \(1-e^{-0.026}\approx 2.6\ \%\) of the way to VDD. It reads whatever was last driven (the bus capacitance remembers it), not a 1.

Why is a bus keeper unsuitable for a chip-select line?

At power-up it holds whatever level it settles into, which may be "selected". A chip select needs a defined inactive level before firmware runs: use a pull-up.

A 3.3 V device's disabled output sits on a 5 V bus. Is it high-Z?

No. Its upper ESD diode clamps the bus at about 3.9 V and injects current into its 3.3 V rail, unless the pin is specified 5 V tolerant (no diode to VDD).

Disable time 7 ns max, enable time 1.5 ns min, controller inserts no gap. Overlap?

\(7-(0+1.5)=5.5\ \text{ns}\) of possible contention on each disagreeing bit. A turnaround cycle of at least 6 ns removes it.

Ten 6 pF loads are spread along a 50 Ω microstrip at 6 pF/in. What impedance does the driver see?

\(C_{0}\approx 3.3\ \text{pF}/\text{in}\); \(Z'=50/\sqrt{1+6/3.3}=50/1.68\approx 30\ \Omega\).

← Push-pullNext: Open-drain →SPI primer →