Schmitt-Trigger Inputs and Open-Drain Outputs
Clean up a slow, noisy input with two thresholds. Share one line between many outputs with open drains and a pull-up.
You Will Be Able To
- Explain why a slow or noisy input makes a plain inverter chatter.
- Describe how the six-transistor Schmitt trigger gets two thresholds.
- Build a wired-AND line from open-drain outputs and a pull-up.
- Choose a pull-up from the rise time, the low level and the current it allows.
- Lesson
- G9.15
- Time
- 30 min
- Runs on
- ngspice
- Check
- 5 questions
A sensor drove a slow, slightly noisy line into a counter. The counter counted 3 or 4 for every real event.
- v(in)
- v(yi), plain inverter
- v(y), Schmitt trigger
- Time 40.69 nsv(in) = 833.6 mV · v(yi), plain inverter = 906.1 mV · v(y), Schmitt trigger = 1.802 V
The input reaches the plain inverter's threshold. Its output starts to fall.
- Time 42.17 nsv(in) = 830.2 mV · v(yi), plain inverter = 905.1 mV · v(y), Schmitt trigger = 1.799 V
A ripple takes the input back below the threshold, and the output rises again.
- Time 49.06 nsv(in) = 833.3 mV · v(yi), plain inverter = 899.4 mV · v(y), Schmitt trigger = 1.801 V
The plain inverter settles after 5 crossings of 0.9 V.
- Time 71.64 nsv(in) = 1.213 V · v(yi), plain inverter = 2.55 mV · v(y), Schmitt trigger = 814 mV
The Schmitt trigger switches only when the input clears its upper threshold, 1.224 V. It crosses 0.9 V once.
Read the plot as a table
| Time | v(in) | v(yi), plain inverter | v(y), Schmitt trigger |
|---|---|---|---|
| 0 s | 300 mV | 1.8 V | 1.8 V |
| 20 ns | 540 mV | 1.799 V | 1.802 V |
| 40 ns | 780 mV | 1.552 V | 1.802 V |
| 40.69 ns | 833.6 mV | 906.1 mV | 1.802 V |
| 42.17 ns | 830.2 mV | 905.1 mV | 1.799 V |
| 49.06 ns | 833.3 mV | 899.4 mV | 1.801 V |
| 60 ns | 1.02 V | 26.74 mV | 1.804 V |
| 71.64 ns | 1.213 V | 2.55 mV | 814 mV |
| 80 ns | 1.26 V | 1.418 mV | 299.4 µV |
| 100 ns | 1.5 V | 109.3 µV | 280.6 µV |
Measured with ngspice 42 on SKY130, 1.8 V. Schmitt trigger all W 1 µm; plain inverter NMOS 1 µm, PMOS 1 µm.
Two Thresholds
A plain inverter has one threshold. An input that lingers near it, or carries noise, crosses it many times.
A Schmitt trigger has two: it switches up at V_T+ and back down at a lower V_T−. Noise smaller than the gap between them cannot make it switch twice.
| Circuit | Input rising: output switches at | Input falling: output switches at | Hysteresis |
|---|---|---|---|
| Schmitt trigger, all W 1 µm | 1.224 V | 0.561 V | 663 mV |
| plain inverter, W 1 µm and 1 µm | 0.833 V | 0.831 V | 2 mV |
Measured: the lab, a triangle from 0 to 1.8 V in 50 ns and back. Thresholds where the output crosses 0.9 V.
- Device
- I/O
- Data
- Control
- Input rising, y = 1
N3 is on and holds the node under N2 high. N2's source sits above ground, so the input must rise further before N2 conducts: up to 1.224 V.
- Input falling, y = 0
Now P3 is on and pulls the node above P2 towards ground. The input must fall further before P2 conducts: down to 0.561 V.
- Sizing
Stronger feedback devices widen the gap; a stronger stack narrows it. Problem G9.15.1 sizes them for a given window.
Read the diagram as text
- P1 and P2: upper stack
- Output y
- N2 and N1: lower stack
- N3: on while y = 1: lifts the node between N2 and N1
- P3: on while y = 0: pulls the node between P1 and P2 down
- P1 and P2 → Output y
- Output y → N2 and N1
- Output y → N3: gate
- Output y → P3: gate
Positive feedback: the output moves the threshold away from the input, so a switch, once made, is held.
Open-Drain Outputs and Wired-AND
An open-drain output has only its NMOS. It can pull a line low, or let go. A pull-up resistor makes the line high when every output has let go.
Connect several open-drain outputs to one line. The line is high only if all of them let go: a wired-AND of their inverted inputs. I2C, interrupt lines and reset lines work this way.
- v(l0), 1 kΩ
- v(l1), 4.7 kΩ
- v(l2), 10 kΩ
- Time 1 µsv(l0), 1 kΩ = 69.01 mV · v(l1), 4.7 kΩ = 14.38 mV · v(l2), 10 kΩ = 6.64 mV
The driver lets go. Each line rises as an RC charge: no transistor helps.
- Time 1.113 µsv(l0), 1 kΩ = 1.62 V · v(l1), 4.7 kΩ = 696.7 mV · v(l2), 10 kΩ = 369.7 mV
With 1 kΩ the line passes 90 % after 113 ns.
- Time 2.15 µsv(l0), 1 kΩ = 1.8 V · v(l1), 4.7 kΩ = 1.787 V · v(l2), 10 kΩ = 1.62 V
With 10 kΩ it takes 1150 ns.
Read the plot as a table
| Time | v(l0), 1 kΩ | v(l1), 4.7 kΩ | v(l2), 10 kΩ |
|---|---|---|---|
| 0 s | 68.66 mV | 14.46 mV | 6.786 mV |
| 500 ns | 68.66 mV | 14.46 mV | 6.786 mV |
| 1 µs | 68.66 mV | 14.46 mV | 6.786 mV |
| 1 µs | 69.01 mV | 14.38 mV | 6.64 mV |
| 1.113 µs | 1.62 V | 696.7 mV | 369.7 mV |
| 1.5 µs | 1.8 V | 1.587 V | 1.14 V |
| 2 µs | 1.8 V | 1.775 V | 1.557 V |
| 2.15 µs | 1.8 V | 1.787 V | 1.62 V |
| 2.5 µs | 1.8 V | 1.797 V | 1.711 V |
| 3 µs | 1.8 V | 1.8 V | 1.767 V |
| 3.5 µs | 1.8 V | 1.8 V | 1.788 V |
| 4 µs | 1.8 V | 1.8 V | 1.796 V |
Measured with ngspice 42 on SKY130, 1.8 V. Pull-down NMOS W 20 µm.
| Pull-up | R × C | Rise, 10 to 90 % | Low level | Current while low |
|---|---|---|---|---|
| 1 kΩ | 50 ns | 110 ns | 69 mV | 1.80 mA |
| 4.7 kΩ | 235 ns | 516 ns | 14 mV | 0.38 mA |
| 10 kΩ | 500 ns | 1099 ns | 7 mV | 0.18 mA |
Measured rise and low level; R × C and 1.8 V / R are arithmetic.
The rise takes about 2.2 R C, as for any RC charging from 10 % to 90 %. Choose R from the rise time you need. Then check that every driver can sink 1.8 V / R and still reach a valid low.
Lines Nobody Drives, and Lines Everybody Drives
Only open-drain (or tri-state) outputs may share a line. Two push-pull outputs that disagree short the supply through their transistors.
An open CMOS input is a z to a simulator and an unknown voltage in silicon. Tie it to a rail, as lesson G9.14 said.
Asked in interviews
What is hysteresis in a Schmitt trigger?
Two switching thresholds: a higher one for a rising input and a lower one for a falling input. Noise smaller than the gap cannot make the output switch back and forth.
Why does I2C use open-drain outputs?
Any device can pull a line low and none can drive it high, so devices never fight. The pull-up makes the line high when all let go, which also allows clock stretching and arbitration.
How do you choose a pull-up resistor?
Its upper limit comes from the rise time: about 2.2 R C for 10 to 90 %. Its lower limit comes from the current each driver can sink while still reaching a valid low level.
Try It
vtp and vtm are the two thresholds of the Schmitt trigger: 1.224 V and 0.561 V.
vi_up and vi_dn belong to the plain inverter: 0.833 V and 0.831 V, almost the same.
Change the widths of the feedback devices SN3 and SP3 to 0.42 µm and run. The window narrows.
Run the netlist to draw its plots here.
vtp = 1.224012e+00 vtm = 5.606323e-01 vi_up = 8.331922e-01 vi_dn = 8.310643e-01Check Yourself
Common Mistakes
Wrong Feed a slow sensor or a long cable straight into a plain gate.
Near its threshold the gate follows every ripple. On the noisy ramp of the figure the plain inverter switched 5 times; the Schmitt trigger switched once.
Fix Use a Schmitt-trigger input wherever an edge can be slow or noisy.
Wrong Leave out the pull-up because some device will pull the line low anyway.
When every open-drain output is off, nothing drives the line. It floats and reads z at switch level, and in silicon it drifts.
Fix Every open-drain line needs exactly one pull-up to the supply of its receivers.
Wrong Choose the largest pull-up to save power.
A 10 kΩ pull-up on 50 pF took 1099 ns to rise from 10 % to 90 %, against 110 ns for 1 kΩ.
Fix Pick the largest resistor that still meets the rise time: R ≤ t_rise / (2.2 C) for 10 to 90 %.
Wrong Choose the smallest pull-up to get a fast edge.
The pull-down must sink 1.8 V / R. With 1 kΩ the line low sat at 69 mV, against 7 mV with 10 kΩ.
Fix Check that the strongest pull-up still lets every driver reach a valid low level within its rated current.
Remember
- A Schmitt trigger has two thresholds, V_T+ and V_T−; noise smaller than the gap cannot make it chatter.
- In the six-transistor version the output switches feedback devices that move the threshold.
- Open-drain outputs only pull low. With one pull-up, several of them form a wired-AND.
- The pull-up sets a slow RC rise of about 2.2 R C, 10 to 90 %. It also draws current while the line is low.
- No pull-up gives a floating line; two push-pull drivers give a fight.