I2C Bus Design
I2C Pull-Up Resistor Calculator
Bound Rp(min) and Rp(max) from supply voltage, sink current and total bus capacitance per NXP UM10204.
UM10204 max rise time: 300 ns; max bus C_b: 400 pF
Common buses: 1.8 V, 3.3 V or 5.0 V
PCB trace + connectors + ~10 pF per device pin
NXP spec: 0.4 V @ 3 mA (Std/Fast), 20 mA (Fm+)
Presets:
Rp(min)967 OhmPrevents Vol exceeding 0.4 V
Rp(max)3.54 kOhmKeeps rise time ≤ 300 ns
Recommended E241.80 kOhmSink current: 1.61 mA
Estimated Rise Time153 nsLimit: 300 ns (0.8473 × R × Cb)
Test how your firmware recovers from I2C NACKs or missing pull-ups in CircuitTwin (suite.yaml):
version: 1
board: nucleo-f767zi
firmware: build/app.elf
tests:
- name: i2c-pullup-and-nack-recovery
faults:
- at_ms: 50
bus: I2C1
kind: nack
address: 0x48
count: 3
expect:
console_contains: "I2C_RECOVERED"
exit_code: 0UM10204 sizing equations
| Bound | Equation | What fails if violated |
|---|---|---|
Rp(min) | (Vcc - Vol(max)) / Iol | Open-drain driver cannot pull SDA/SCL below logic-low threshold; receivers miss ACK bits. |
Rp(max) | t_r(max) / (0.8473 * C_b) | RC rising edge stays too slow (30% to 70% Vcc); clock stretching or missed STOP conditions occur. |
0.8473 factor | ln(0.7) - ln(0.3) = ln(7/3) | Derived directly from RC charge time between 0.3 Vcc and 0.7 Vcc thresholds. |
Common bench traps
| Trap | Cause & fix |
|---|---|
| Stacked breakout pull-ups | Three breakout boards each carrying 10 kOhm pull-ups drop effective pull-up to 3.3 kOhm. Four 4.7 kOhm breakouts hit 1.18 kOhm and violate 3 mA sink limits on 3.3 V sensors. |
| Weak internal GPIO pull-ups | Typical 30–50 kOhm internal MCU pull-ups only work on short traces at low clocks and fail 400 kHz rise times even at 20 pF. |
| Stuck-low SDA recovery | If the MCU resets mid-read while a sensor holds SDA low, toggle 9 SCL clock pulses followed by a STOP condition before enabling the hardware I2C peripheral. |