On Sun, Oct 29, 2017 at 10:43:44PM -0700, Stephen Graf wrote: > Hi Artturi, > > Now that I have a working NIC on my orangepi one, I turned my attention back > to the BME280 sensors. I put a second sensor on the system, this time on > the i2c0 bus and changed the dtb to what is included below. My first > question is, does the dtb look ok? > > I am having some difficulties. When both sensors are connected the first > sensor works, but the second gets an error reading the calibration > registers. If I disconnect the first sensor, the second sensor works. > > Both sensors connected: > > # tail -100 /var/log/messages > ... > Oct 29 22:16:42 openbsdop1 /bsd: sxitwi0 at simplebus0 > Oct 29 22:16:42 openbsdop1 /bsd: iic0 at sxitwi0 > Oct 29 22:16:42 openbsdop1 /bsd: bme0 at iic0 addr 0x76: BME280 60 > Oct 29 22:16:42 openbsdop1 /bsd: sxitwi1 at simplebus0 > Oct 29 22:16:42 openbsdop1 /bsd: iic1 at sxitwi1 > Oct 29 22:16:42 openbsdop1 /bsd: bme1 at iic1 addr 0x76: BME280 60: failed > to read calib24 register > Oct 29 22:16:42 openbsdop1 /bsd: sxitwi2 at simplebus0 > Oct 29 22:16:42 openbsdop1 /bsd: iic2 at sxitwi2 > > # sysctl hw.sensors > hw.sensors.bme0.temp0=21.02 degC > hw.sensors.bme0.humidity0=55.40% > hw.sensors.bme0.pressure0=101.44 Pa > > > Only second sensor connected: > > # tail -100 /var/log/messages > ... > Oct 29 22:21:39 openbsdop1 /bsd: sxitwi0 at simplebus0 > Oct 29 22:21:39 openbsdop1 /bsd: iic0 at sxitwi0 > Oct 29 22:21:39 openbsdop1 /bsd: bme0 at iic0 addr 0x76: cannot read ID > register > Oct 29 22:21:39 openbsdop1 /bsd: sxitwi1 at simplebus0 > Oct 29 22:21:39 openbsdop1 /bsd: iic1 at sxitwi1 > Oct 29 22:21:39 openbsdop1 /bsd: bme1 at iic1 addr 0x76: BME280 60 > Oct 29 22:21:39 openbsdop1 /bsd: sxitwi2 at simplebus0 > Oct 29 22:21:39 openbsdop1 /bsd: iic2 at sxitwi2 > > # sysctl hw.sensors > hw.sensors.bme1.temp0=21.64 degC > hw.sensors.bme1.humidity0=50.11% > hw.sensors.bme1.pressure0=101.41 Pa > > > Section of DTB with i2c: > > i2c@01c2ac00 { > compatible = "allwinner,sun6i-a31-i2c"; > reg = <0x1c2ac00 0x400>; > interrupts = <0x0 0x6 0x4>; > clocks = <0x2 0x3b>; > resets = <0x2 0x2e>; > pinctrl-names = "default"; > pinctrl-0 = <0x13>; > status = "okay"; > #address-cells = <0x1>; > #size-cells = <0x0>; > > bme@0 { > reg = <0x76>; > interrupts = <0x0>; > compatible = "bosch,bme280"; > }; > }; > > i2c@01c2b000 { > compatible = "allwinner,sun6i-a31-i2c"; > reg = <0x1c2b000 0x400>; > interrupts = <0x0 0x7 0x4>; > clocks = <0x2 0x3c>; > resets = <0x2 0x2f>; > pinctrl-names = "default"; > pinctrl-0 = <0x14>; > status = "okay"; > #address-cells = <0x1>; > #size-cells = <0x0>; > > bme@1 { > reg = <0x76>; > interrupts = <0x0>; > compatible = "bosch,bme280"; > }; > }; > > i2c@01c2b400 { > compatible = "allwinner,sun6i-a31-i2c"; > reg = <0x1c2b400 0x400>; > interrupts = <0x0 0x8 0x4>; > clocks = <0x2 0x3d>; > resets = <0x2 0x30>; > pinctrl-names = "default"; > pinctrl-0 = <0x15>; > status = "okay"; > #address-cells = <0x1>; > #size-cells = <0x0>; > }; >
Hi, i don't think i have the branch with bme280.c anymore, but if you send it to me, we could try deferring the setup, for later in the boot, when IRQs get handled etc., to avoid polling/retrys in _attach(). -Artturi