Bosch Sensortec Community

    BME680 I2C read and write

    Highlighted
    Community Moderator

    Re: BME680 I2C read and write

    It is not clear if your issue is related to the case above, therefore I would suggest creating your own thread/topic.

    Some information are missing to support your issue here, for instance:

    • Can you confirm that communication is successful at all, for example by reading the chip ID? We recommend using our official Sensor API, which does this check in its init function. Is this function returning any error code for you?
    • If you have communication issue, it could be helpful to share a capture of a transaction using an oscilloscope or logic analyzer.
    • It is mandatory to read the trimming registers for the compensation formulas to work. This is also done in the same init function as above. To review the implementation we would need you to share both the raw adc input fed to the compensation formulas (i.e. adc_temp, adc_pres, adc_hum, adc_gas_res and gas_range from here) as well as all of your calib_data values.
    • Also feel free to share your initialization, configuration and read-out code/routines using the sensor API.
    • ...
    Highlighted
    Established Member

    Re: BME680 I2C read and write

    Hi

    A seperate note here:

    in case you don't want to spend too much time on debugging the i2c communication issues, a much easier way is to use an Arduino board to work with BME680 sensor.

    The key is that every Arduino board uses the same APIs for I2C communication and this abstraction make it much more consistent and easier to get started.

    Once you have the Arduino board, you could refer to example made available by Adafruit here:

    https://github.com/adafruit/Adafruit_BME680

    specifically the source code https://github.com/adafruit/Adafruit_BME680/blob/master/Adafruit_BME680.cpp contains a working example of how the read/write are setup by wrapping around the Arduino I2C APIs.

    ``

    bool Adafruit_BME680::begin(uint8_t addr, bool initSettings) {
    _i2caddr = addr;

    if (_cs == -1) {
    // i2c
    _wire->begin();

    gas_sensor.dev_id = addr;
    gas_sensor.intf = BME680_I2C_INTF;
    gas_sensor.read = &i2c_read;
    gas_sensor.write = &i2c_write;

    }

    ``

    }

    ``

    I used this, and it works like a breeze. Hope this helps.

     

     

     

     

     

     

     

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist