User avatar
clicky
Posts: 279
Joined: Thu Oct 25, 2012 7:34 am

RPi4 and i2c; Has anyone used additional i2c buses?

Sun Jul 07, 2019 2:31 pm

Has anyone used additional i2c buses?

It would be really nice switching from using multiplexer to directly driving distance sensors on separate buses (there are 8 vl53l1x I would like to read and bottleneck is it being so chatty on the bus).

User avatar
IOTON
Posts: 69
Joined: Tue Jul 02, 2019 1:00 pm
Contact: Website

Re: RPi4 and i2c; Has anyone used additional i2c buses?

Mon Jul 08, 2019 2:23 am

clicky wrote:
Sun Jul 07, 2019 2:31 pm
Has anyone used additional i2c buses?

It would be really nice switching from using multiplexer to directly driving distance sensors on separate buses (there are 8 vl53l1x I would like to read and bottleneck is it being so chatty on the bus).
just buy usb-i2c adapter

User avatar
Gavinmc42
Posts: 3172
Joined: Wed Aug 28, 2013 3:31 am

Re: RPi4 and i2c; Has anyone used additional i2c buses?

Mon Jul 08, 2019 2:46 am

Even the Pi4 does not have enough i2c ports for 8 laser sensors.
You could use a micro to multiplex the data down to a smaller number of ports.
Is there a SPI to i2c multiplexer?

The old kernel had the ability to bit bang i2c on any GPIO, pick up a few more ports that way?
I always had trouble with i2c and Linux, since moving to Ultibo it just works, but that is not Pi4 ready yet.
Use one core to bit bang GPIO, one GPIO for SCL to many sensors?

Have you been able to use the scanning function in those sensors?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
clicky
Posts: 279
Joined: Thu Oct 25, 2012 7:34 am

Re: RPi4 and i2c; Has anyone used additional i2c buses?

Sat Jul 13, 2019 11:40 am

Huh - those were answers to completely different questions: I know how to drive more than one VL53L1X (or VL53L0X) on one i2c bus - you can have as many of those as you want given you have extra GPIOs to keep their XSHUT off while configuring them one by one. But, that's not the point. Problem is that even at increased i2c clock, having more than two on the same bus slows reading frequency as they are very 'chatty'.

So, let's return back to the subject: Pi4 has 'four additional' i2c buses exposed on GPIOs - see here for instance:

Image

Having extra, hardware i2c ports does help with bandwidth (in comparison to i2c multiplexer - like PCA9545A - see here http://piwars.abstracthorizon.org/posts ... ltiplexer/ - where you are not expanding bandwidth but just allow devices with same address being on the same i2c bus).

So, has anyone used additional i2c buses on Raspberry Pi 4, yet, and how hard are they to be configured? I haven't found documentation regarding it, yet...

User avatar
clicky
Posts: 279
Joined: Thu Oct 25, 2012 7:34 am

Re: RPi4 and i2c; Has anyone used additional i2c buses?

Sat Jul 13, 2019 12:27 pm

BTW I have added

Code: Select all

dtoverlay=i2c3
dtoverlay=i2c4
dtoverlay=i2c5
dtoverlay=i2c6
To /boot/config and only following buses appeared:

Code: Select all

 $ l /dev/i2c-*
crw-rw---- 1 root i2c 89, 1 Jul 13 12:59 /dev/i2c-1
crw-rw---- 1 root i2c 89, 3 Jul 13 12:59 /dev/i2c-3
crw-rw---- 1 root i2c 89, 4 Jul 13 12:59 /dev/i2c-4
crw-rw---- 1 root i2c 89, 5 Jul 13 12:59 /dev/i2c-5
Also

Code: Select all

i2cdetect -y 5
for instance is working very, very slowly (same with 3 and 4), which indicates that something is not quite right. Not even following helped:
.

Code: Select all

$ gpio -g mode 12 alt5
$ gpio -g mode 13 alt5

Return to “Interfacing (DSI, CSI, I2C, etc.)”