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.
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.
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.
| EN | IN | PMOS gate | NMOS gate | PMOS | NMOS | Pin |
|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 1 | off | on | 0 (driven) |
| 1 | 1 | 0 | 0 | on | off | 1 (driven) |
| 0 | x | 1 | 0 | off | off | Z (released) |
A disabled output still has three things attached to the pin:
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Ω.
When every driver is disabled, the bus is a capacitor with nothing defining its charge except leakage and coupling. Two mechanisms move it.
The net leakage of all pins (some source, some sink, they do not cancel reliably) charges the bus capacitance:
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.
An undriven node is a capacitive divider. Every edge on an adjacent trace with mutual capacitance Cc moves it by
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.
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:
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.
After release the bus relaxes toward the pull rail with time constant RCbus:
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.
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.
Disabling an output does not happen instantly, and neither does enabling one. Datasheets give four times, measured from the enable edge:
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
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
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.
A disabled driver contributes its Cout plus its input buffer's Cin. On a short bus (lumped) the active driver sees the sum:
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:
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.
| Interface | Who drives when | What to watch |
|---|---|---|
| SPI MISO | Only the peripheral whose CS̅ is low; the others are Z | Some 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 bus | Memory on reads (OE̅ low), controller on writes | Read-to-write turnaround versus tHZOE/tHZCE; bus capacitance with many devices; keepers or pulls for the idle data bus. |
| JTAG TDO | Device 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 data | Several ADCs each drive in their own time slot | Slot-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 direction | Both sides as outputs at the same time after a reset or a firmware bug: add series resistance. |
| RS-485 half duplex | The node that holds DE (driver enable) high | The differential version of the same problem, with fail-safe biasing instead of a pull-up: see differential push-pull. |
\(\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.
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.
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).
\(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.
\(C_{0}\approx 3.3\ \text{pF}/\text{in}\); \(Z'=50/\sqrt{1+6/3.3}=50/1.68\approx 30\ \Omega\).