Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4157

Advanced users • Re: Using I2C 5 and DPI 666 simultaneously

$
0
0
Ever played your countries lottery? Looks like your 'the lucky guy' so give it a chance!

Why do I say that? Simply because of
Name: i2c-gpio
Info: Adds support for software i2c controller on gpio pins
Load: dtoverlay=i2c-gpio,<param>=<val>
Params: i2c_gpio_sda GPIO used for I2C data (default "23")

i2c_gpio_scl GPIO used for I2C clock (default "24")

i2c_gpio_delay_us Clock delay in microseconds
(default "2" = ~100kHz)

bus Set to a unique, non-zero value if wanting
multiple i2c-gpio busses. If set, will be used
as the preferred bus number (/dev/i2c-<n>). If
not set, the default value is 0, but the bus
number will be dynamically assigned - probably
3.
I took a CM4 based device and connected it to my 'standard' I2C testbed - a small board with a TLC59116 LED driver and 4 pcs of RGB LEDs.
in config.txt I took the 'lucky guys approach' to see what I2C-bus number lottery will give me

Code:

dtoverlay=i2c-gpio,i2c_gpio_sda=10,i2c_gpio_scl=11
reboot and check what I've got. Make a bet ... not what you see when doing the same!

Code:

pi@cm4:~ $ sudo i2cdetect -li2c-20i2c       fef04500.i2c                    I2C adapteri2c-21i2c       fef09500.i2c                    I2C adapteri2c-22i2c       ffffffff00000002.i2c            I2C adapterpi@cm4:~ $ sudo i2cdetect -y 22     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f00:                         -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: 60 -- -- -- -- -- -- -- 68 -- -- 6b -- -- -- -- 70: -- -- -- -- -- -- -- --                         pi@cm4:~ $ 
As you can see I've ended up with my SW I2C on Bus-no 22.
That your particular Pi is ending with SW IC2-11 enabled is purely random!

changing the config and adding a fixed number to the SW-I2C overlay

Code:

dtoverlay=i2c-gpio,bus=5,i2c_gpio_sda=10,i2c_gpio_scl=11
will result in

Code:

pi@cm4:~ $ sudo i2cdetect -li2c-5i2c       500000002.i2c                   I2C adapteri2c-20i2c       fef04500.i2c                    I2C adapteri2c-21i2c       fef09500.i2c                    I2C adapterpi@cm4:~ $ sudo i2cdetect -y 5     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f00:                         -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: 60 -- -- -- -- -- -- -- 68 -- -- 6b -- -- -- -- 70: -- -- -- -- -- -- -- --                         pi@cm4:~ $ 
As expected, SW I2C-5 is enabled and the device is there.

Note: your results may look different as I don't know which Pi you have (I'm on CM4).

Statistics: Posted by aBUGSworstnightmare — Fri Jan 19, 2024 8:24 am



Viewing all articles
Browse latest Browse all 4157

Trending Articles