Tip: getting I2C out of a Mainboard

If you want to get I2C for your own Mainboard-based projects, you can use a RP2040 board, but you can also get I2C out of a spare HDMI card, provided you run Linux!

All you need is the HDMI card (or any other USB-C to HDMI adapter) and a HDMI breakout; use pins SDA, SCL, 5V and GND. Add pullups from SDA and SCL to 5V (1.8K-10K range pullups). The resulting bus will be 5V-referenced, use a level shifter if you need 3.3V, or maybe do pullups to 3.3V. You also need to pull HDMI HPD to 5V, same 1.8K-10K range.

On the Linux side, you need to modprobe i2c-dev. Use i2cdetect -l to see which I2C buses are exposed to userspace. It will be one of the AUX USBC1/DDI TC1/PHY TC buses in the list - run i2cdetect on all four and see which one detects your device. You can then use libraries like python-smbus to interact with your I2C stuff!

I will also be selling a touchpad I2C port breakout soon, but, that I2C is EC-connected and isn’t quite exposed to the userspace… I think?

9 Likes

Interesting!
I vaguely feel like I heard about this, but then again I don’t think I have because my next question is, can all HDMI ports provide this?

from what I know, doing this on RPi involves some fuckery that might make monitor detection work worse or not at all, and NVIDIA proprietary drivers also don’t support it iirc? For AMD (open-source drivers by default), NVIDIA open-source drivers (very situational) and Intel GPUs, however, this should work! and, as for ARM and other SoCs, that will be on a CPU by CPU basis.

1 Like