[Banana BPI-R4] how to enable I2C?

I would focus on one controller at a time, create only one .dto and use something like this:

fragment@0 {
		target = <&i2c1>;
		__overlay__ {
			pinctrl-names = "default";
			pinctrl-0 = <&i2c1_pins>;
			status = "okay";
		};
	};

the same as before :frowning:

@daniel any ideas?

Complete bootlog please and complete diff towards OpenWrt main branch, so I can see what you are actually doing.

Like you advised before:
1.dts file was created and added to `filogic.mk, image compiled
2. once booted symptoms are the same as in the beging of the thread: device not detected by i2cdetect and no file at /sys/class/i2c-dev/i2c-1/new_device
3. no compilling again the image using some include headers in dts file as maybe needed

https://drive.google.com/drive/folders/1uflfBmTIfxAbS0RnYGq5e1Ucv0nWwc78?usp=drive_link

all is there image, logs , dts files...

After some time spent and many tests with dts files... Finally I succeed to enable I2C on my BPI-R4.
Steps:

  1. Missing was 11004000.i2c bus (ref to i2c1) as after all my tests I was able to find only that:
    root@BPI-R4:/sys/devices/platform/soc# ls -ltr i2c
    11005000.i2c:
    11003000.i2c:

  2. I gave up to create dedicated dtso file but I went directlly to mt7988a.dtsi and I enabled i2c1 there as below:
    i2c1: i2c@11004000 {
    compatible = "mediatek,mt7988-i2c",
    "mediatek,mt7981-i2c";
    reg = <0 0x11004000 0 0x1000>,
    <0 0x10217100 0 0x80>;
    ...
    status = "okay"; >>> was "disabled"
    };
    And I recompiled the image.

  3. After OS came up I see now:
    root@BPI-R4:~# ls -dl /sys/devices/platform/soc/1100*.i2c
    drwxr-xr-x 4 root root 0 Jan 1 1970 /sys/devices/platform/soc/11003000.i2c
    drwxr-xr-x 4 root root 0 Jan 1 1970 /sys/devices/platform/soc/11004000.i2c >>> i2c1 detected :slight_smile:
    drwxr-xr-x 4 root root 0 Jan 1 1970 /sys/devices/platform/soc/11005000.i2c

  4. So rescan i2c-1

root@BPI-R4:~# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@BPI-R4:~# i2cdetect -r 1
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1 using receive byte commands.
I will probe address range 0x08-0x77.
Continue? [Y/n] Y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- 38 -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77

Now I see all my test devices:
IMU: ICM-20948 (address 0x68, SEN-15335)
BMP280 - 0x77
AHT20 - 0x38
VCNL4040 - 0x60
LCD - 0x3c

I2C pins: 1=3,3V, 3=GPIO18/I2C_1_SDA, 5=GPIO17/I2C_1_SCL, 6=gnd or 9=gnd

1 Like

BPI-R4-I2C
Small test

Maybe Im wrong but probably some other dtso definition/files already enabled by default in fresh image creation could cause some inconsitency in enabling i2c1 (as example above). Maybe if I placed my dtso file to load the very first one could solve the issue....

we can also enable i2c1 by adding in mt7988a-bananapi-bpi-r4.dts:

&i2c1 {
status = "okay";
};

Not needed to change status for i2c1 in mt7988a.dtsi

Hi! I use a latest snapshot but cannot find this file. I have a 3 questions:

  1. Whereis mt7988a-bananapi-bpi-r4.dts ?
  2. How to send information to OLED (ssd1306) ?
  3. There two pins for USB (con3 header on schematic) but if connect any devices nothing happen - not enabled ?

All is here

1 Like