Interfacing Bosch BME680

Hi,

I am trying the sample code in this regard. I have changed the I2C pins in the overllay file and bme register address to 0x77 as follows. It seems working but I have many questions.

&i2c0 {
	compatible = "nordic,nrf-twi";
	status = "okay";
	bme680: bme680@77 {
		compatible = "bosch,bme680";
		label = "BME680";
		reg = <0x77>;
	};
};

1. I think this is using the Zephyr built in bme680 driver, isn't it?

2. I am evaluating both BME680 and BME688.  How can I change code to suit BME688?

3. My case is a battery powered sensor, so I have to make it as much power efficient as possible. The sample program doesnt seem to meet that goal. I tried commenting out each channel and it doesn't seem that affect the power consumption.  I tried using 'sensor_sample_fetch_chan (dev, SENSOR_CHAN_AMBIENT_TEMP) just to fetch temp channel, but still same. Any idea why?

4. I want to read/write registers of the sensor, but Sensor API doesn't seem to provide any interface. How can I do  this?

Cheers,

Kaushalya

  • Hi,

    Need some help building the sample with CONFIG_BME68X_IAQ_SAMPLE_RATE_QUICK_ULTRA_LOW_POWER. I get the build errors saying

    C:/ncs/v2.6.0/nrf/drivers/sensor/bme68x_iaq/bme68x_iaq.c:35:32: error: 'BSEC_GAS_SAMPLE_RATE' undeclared here
    ..
    C:/ncs/v2.6.0/nrf/drivers/sensor/bme68x_iaq/bme68x_iaq.c:57:32: error: 'BSEC_SAMPLE_RATE' undeclared here
    ...
    C:/ncs/v2.6.0/nrf/drivers/sensor/bme68x_iaq/bme68x_iaq.c:463:35: error: 'BSEC_SAMPLE_PERIOD_S' undeclared

    If I use any other such as

    CONFIG_BME68X_IAQ_SAMPLE_RATE_ULTRA_LOW_POWER=y, it builds ok.
    I cant figure out what is the difference. 
    Please help.
    Cheers,
    Kaushalya

     

  • Hi Kaushalya, 

    my apologies for the late reply, for some reason my answer was not sent yesterday. I need to discuss internally in regards to the driver, and why it fails with QUICK_ULTRA_LOW_POWER and not ULTRA_LOW_POWER.

    I hope to have an answer by end of today or Monday.

    Kind regards,
    Øyvind

  • Hello again, 

    This is a bug and has been fixed in e.g. v2.8.0, but the problem is found in nrf\drivers\sensor\bme68x_iaq\CMakeLists.txt. In this file, ~ line 27, you can see that zephyr_library_compile_definitions_ifdef is pointing to BME68X_IAQ_SAMPLE_RATE_QUICK_ULTRA_LOW_POWER and not CONFIG_BME68X_IAQ_SAMPLE_RATE_QUICK_ULTRA_LOW_POWER

    If you replace the whole line with zephyr_library_compile_definitions_ifdef(BME68X_IAQ_SAMPLE_RATE_QUICK_ULTRA_LOW_POWER it should build as intended.

    Let me know how that works for you.


    KInd regards,
    Øyvind

  • Hi,

    I have infact done this modification earlier, but no luck. Strangely I built the project and SDK from scratch at home over the weekend and it was successful!! Only diff I did was I executed the

     

    west config manifest.group-filter +bsec
    west update

    within different folders. I cant exactly remember which is which, but does it matter you run the west update from within SDK folder or zephyr folder? The BME68X IAQ driver page does not indicate which folder you should be in before executing the west update. 

    Anyway I did the same today at my office project folder and got it compiled.

    Now I can get the BME68x driver reading from my project.

    I wanted to play around the sample timings as outlined in the 

    BSEC_SAMPLE_RATE=BSEC_SAMPLE_RATE_LP
    BSEC_GAS_SAMPLE_RATE=BSEC_SAMPLE_RATE_ULP
    BSEC_SAMPLE_PERIOD_S=3

    I found these timing values are defined in C:\ncs\v2.6.0\modules\lib\bsec\src\inc\bsec_datatypes.h. But when I changed the 'BSEC_SAMPLE_RATE_ULP' and 'BSEC_SAMPLE_RATE_LP' to different values (0.00167f and 0.017f) the driver seemed to stop sending any I2C comms to the BME68x. Any idea why?

    Also is there a way to modify these timings without modifying files in the SDK? Update the SDK and you loose all your settings.

    Cheers,

    Kaushalya

  • Hi,

    After further debugging, I can see with my modified timing, I get the ' BSEC_W_SC_CALL_TIMING_VIOLATION' error from 'bsec_sensor_control ()', which is invoked from 'bsec_thread_fn ()'.

    The comment of this this error code says 'Difference between actual and defined sampling intervals of bsec_sensor_control() greater than allowed'.

    I couldnt find the source of bsec_sensor_control ().  

    What are the limits of these timings? How can we change the timings to suit our application?

    Cheers,

    Kaushalya

Related