Re: i2c bus via USB adapter

From: Dr. Rolf Jansen <freebsd-rj_at_cyclaero.com>
Date: Mon, 11 Jul 2022 03:18:59 UTC
> Am 10.07.2022 um 23:18 schrieb John Kennedy <warlock@phouka.net>:
> 
> Along with trying to attach some I2C devices to my RPI4 (which has
> GPIO-pin exposure issues due to heatsink-case), I tried attaching this
> device from Adafruit:
> 
> 	Adafruit MCP2221A Breakout - General Purpose USB to GPIO ADC I2C Stemma QT / Qwiic
> 	https://www.adafruit.com/product/4471

I cannot help you with this piece.

However, did you know that we can easily enable just some more I2C busses of the RPi4 using other pins on the header. For example I enabled I2C5 running on GPIO12/13. This works concurrently to the default I2C1 on GPIO2/3.

The respective numbers of the physical pins on the header for I2C5 are:
  17: 3.3 V
  32: SDA
  33: SCL
  34: GND

These pins are on the other end to where you connected the vent of the heat sink, and chances are that these are still accessible.

Anyway, for enabling I2C5 (we may choose from I2C3, I2C4, I2C5 and I2C6) on a Raspberry Pi 4, we do:

# fetch https://github.com/raspberrypi/linux/blob/rpi-5.15.y/arch/arm/boot/dts/overlays/i2c5-overlay.dts
# dtc -I dts -O dtb -b0 -@ -o /boot/msdos/overlays/i2c5.dtbo i2c5-overlay.dts

Then we add the following 2 lines to /boot/msdos/config.txt:

  gpio=12,13=a5
  dtoverlay=i2c5,pins_12_13

While my DS3231 RTC breakout board worked on these pins (phys. #32,#33) without any problem, I needed to add 3.3 kΩ pull-up resistors to the SDA and SCL lines for other modules. Most probably said RTC breakout came already with pull-ups on board. Anyway, finally I left the RTC on the default I2C bus.

In dmesg:

  ...
  iicbus0: <OFW I2C bus> on iichb0
  iic0: <I2C generic I/O> on iicbus0
  ds32310: <Maxim DS3231 RTC> at addr 0xd0 on iicbus0
  iicbus1: <OFW I2C bus> on iichb1
  iic1: <I2C generic I/O> on iicbus1
  ...