Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jul 2022 00:18:59 -0300
From:      "Dr. Rolf Jansen" <freebsd-rj@cyclaero.com>
To:        freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: i2c bus via USB adapter
Message-ID:  <FADF0E7F-BB60-4A4A-B227-87CA912841AE@cyclaero.com>
In-Reply-To: <YsuIZS0/IrLjsVvR@phouka1.phouka.net>
References:  <YsuIZS0/IrLjsVvR@phouka1.phouka.net>

next in thread | previous in thread | raw e-mail | index | archive | help
> Am 10.07.2022 um 23:18 schrieb John Kennedy <warlock@phouka.net>:
>=20
> 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:
>=20
> 	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/ove=
rlays/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=3D12,13=3Da5
  dtoverlay=3Di2c5,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=CE=A9 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
  ...=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?FADF0E7F-BB60-4A4A-B227-87CA912841AE>