Hi!
I bought a Raspberry Pi 4b 8Gb recently and am currently trying to adapt the drivers I earlier wrote for armv7.
But I stumbled on the second i2c bus - can they both be used at the same time at all, iic0 and iic1 buses, on rpi4?
I try to use an rtc "ds3231" on pins 2,3 and a lightsensor "bh1750" on pins 27,28.
My config.txt:
My loader.conf:
bh1750-rpi4-i2c.dtso:
After boot I check if devices are properly detected:
I see that the bh1750 (addr=23) is bond to iicbus1 (how can this be possible?), but
And of course "bh1750.ko" cannot find the device as it searches for it on iicbus1:
Is this a bug or am I doing something wrong?
I bought a Raspberry Pi 4b 8Gb recently and am currently trying to adapt the drivers I earlier wrote for armv7.
But I stumbled on the second i2c bus - can they both be used at the same time at all, iic0 and iic1 buses, on rpi4?
Code:
FreeBSD rhino 13.0-STABLE FreeBSD 13.0-STABLE #2 stable/13-n248706-c3593fcdfb0d: Sat Dec 25 19:01:13 +04 2021 root@rhino:/usr/obj/usr/src/arm64.aarch64/sys/RPI4_RHINO arm64
I try to use an rtc "ds3231" on pins 2,3 and a lightsensor "bh1750" on pins 27,28.
My config.txt:
INI:
[all]
arm_64bit=1
dtparam=audio=on,i2c_arm=on,spi=off
dtparam=i2c_vc=on
gpio=0,1,2,3=a0
device_tree_address=0x4000
device_tree=bcm2711-rpi-4-b.dtb
kernel=u-boot.bin
dtoverlay=i2c-rtc,ds3231=on
INI:
fdt_overlays="tm1637-gpio-rpi4,rcrecv-gpio-rpi4,bh1750-rpi4-i2c"
bh1750-rpi4-i2c.dtso:
INI:
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2711";
};
&i2c_arm {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
bh1750: light-sensor@23 {
compatible = "rohm,bh1750";
reg = <0x23>;
mtreg = <0x45>;
status = "okay";
};
};
After boot I check if devices are properly detected:
Bash:
[root@rhino /]# dmesg | grep iic
iichb0: <BCM2708/2835 BSC controller> mem 0x7e205000-0x7e2051ff irq 19 on simplebus0
iichb1: <BCM2708/2835 BSC controller> mem 0x7e804000-0x7e804fff irq 26 on simplebus0
iicbus0: <OFW I2C bus> on iichb0
iic0: <I2C generic I/O> on iicbus0
iicbus1: <OFW I2C bus> on iichb1
iic1: <I2C generic I/O> on iicbus1
iicbus1: <unknown card> at addr 0x46
ds32310: <Maxim DS3231 RTC> at addr 0xd0 on iicbus1
[root@rhino /]# i2c -s
Hardware may not support START/STOP scanning; trying less-reliable read method.
Scanning I2C devices on /dev/iic0: 23
[root@rhino /]# i2c -s -f /dev/iic1
Hardware may not support START/STOP scanning; trying less-reliable read method.
Scanning I2C devices on /dev/iic1: 68
I see that the bh1750 (addr=23) is bond to iicbus1 (how can this be possible?), but
i2c
found it on /dev/iic0.
Bash:
[root@rhino /]# i2c -a 0x23 -f /dev/iic0 -m tr -d r -c 2 -v -w 0
dev: /dev/iic0, addr: 0x23, r/w: r, offset: 0x00, width: 0, count: 2
Data read (hex):
00 05
Code:
bh17500: <BH1750 Ambient light sensor with an i2c interface> at addr 0x46 on iicbus1
bh17500: failed to connect to the device
Is this a bug or am I doing something wrong?