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.

I2C speed modeStandard Mode (100 kHz)Fast Mode (400 kHz)Fast-Mode Plus (1 MHz)UM10204 max rise time: 300 ns; max bus C\_b: 400 pF

Supply voltage Vcc (V)Common buses: 1.8 V, 3.3 V or 5.0 V

Total bus capacitance Cb (pF)PCB trace + connectors + \~10 pF per device pin

Vol(max) (V) / Iol (mA)NXP spec: 0.4 V @ 3 mA (Std/Fast), 20 mA (Fm+)

Presets:

Rp(min) 967 Ohm Prevents Vol exceeding 0.4 V

Rp(max) 3.54 kOhm Keeps rise time ≤ 300 ns

Recommended E24 1.80 kOhm Sink current: 1.61 mA

Estimated Rise Time 153 ns Limit: 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: 0
```

## UM10204 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.                  |

[Guide: I2C NACK fault injection](https://circuittwin.ai/guides/i2c-nack-fault-injection) [Twin: TCA9548A I2C Mux](https://circuittwin.ai/twins/tca9548a) [Twin: TMP117 I2C Temp Sensor](https://circuittwin.ai/twins/tmp117) [Twin: BME680 Environment Sensor](https://circuittwin.ai/twins/bme680) [Tool: SPI Clock Divider Calculator](https://circuittwin.ai/tools/spi-clock-divider-calculator)

> ## Inject I2C NACKs and bus disconnects in CI
>
> Verify your driver retry loops and 9-clock bus-recovery sequence against real sensor twins without cutting PCB traces.
>
> [Start now](https://app.circuittwin.ai/try) [I2C fault-injection guide](https://circuittwin.ai/guides/i2c-nack-fault-injection) [Connect a coding agent](https://circuittwin.ai/docs/agents)
