problem connecting two BME280 sensors

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

problem connecting two BME280 sensors

Stephen Graf
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>;
                };

Reply | Threaded
Open this post in threaded view
|

Re: problem connecting two BME280 sensors

Rob Sciuk



On Sun, 29 Oct 2017, Stephen Graf wrote:

> Date: Sun, 29 Oct 2017 22:43:44 -0700
> From: Stephen Graf <[hidden email]>
> To: [hidden email], [hidden email]
> Subject: problem connecting two BME280 sensors
>
> 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.


Stephen,

Am I mistaken, or are both the bme0 and bme1 sharing the same i2c address
(0x76) on the same bus?  Perhaps there are jumpers to change the address
of the second sensor to a different address??

Just wondering ...

Cheers,
Rob Sciuk


>
> 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>;
>                };
>
>

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Robert Sciuk                                                          [hidden email]
97 Village Rd.                                                            289.312.1278
Wellesley, ON. N0B 2T0

Reply | Threaded
Open this post in threaded view
|

Re: problem connecting two BME280 sensors

Rob Sciuk



On Mon, 30 Oct 2017, Rob Sciuk wrote:

>
> Stephen,
>
> Am I mistaken, or are both the bme0 and bme1 sharing the same i2c address
> (0x76) on the same bus?  Perhaps there are jumpers to change the address of
> the second sensor to a different address??
>
> Just wondering ...
>
> Cheers,
> Rob Sciuk
>
>
Nevermind.  Upon closer inspection of the DTC I see that the
configurations are on different busses, and the 0x76 refers to the bus
rather than the device ...


--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Robert Sciuk                                                          [hidden email]
97 Village Rd.                                                            289.312.1278
Wellesley, ON. N0B 2T0

Reply | Threaded
Open this post in threaded view
|

Re: problem connecting two BME280 sensors

Artturi Alm
In reply to this post by Stephen Graf
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

Reply | Threaded
Open this post in threaded view
|

Re: problem connecting two BME280 sensors

Stephen Graf
In reply to this post by Rob Sciuk
Thank you for taking interest.  I am sorry that I did not make it clear that
the two devices were on different i2c busses and so using the same device
address (0x76) is not a problem.

-----Original Message-----
From: Rob Sciuk [mailto:[hidden email]]
Sent: Monday, October 30, 2017 11:18 AM
To: Stephen Graf <[hidden email]>
Cc: [hidden email]; [hidden email]
Subject: Re: problem connecting two BME280 sensors




On Mon, 30 Oct 2017, Rob Sciuk wrote:

>
> Stephen,
>
> Am I mistaken, or are both the bme0 and bme1 sharing the same i2c
> address
> (0x76) on the same bus?  Perhaps there are jumpers to change the
> address of the second sensor to a different address??
>
> Just wondering ...
>
> Cheers,
> Rob Sciuk
>
>
Nevermind.  Upon closer inspection of the DTC I see that the configurations
are on different busses, and the 0x76 refers to the bus rather than the
device ...


--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-=-=-=-=-=-=
Robert Sciuk
[hidden email]
97 Village Rd.
289.312.1278
Wellesley, ON. N0B 2T0