Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Getting error in bme680 calibration function.

    Getting error in bme680 calibration function.

    Sudeep1310
    Member

    Hi,

    I am trying to get compile bme680_init() function only and it interfaced with the BlueNRG-2 (BLE+MCU)module. I am using  Keil compiller. Please look below for reference

    struct bme680_dev gas_sensor;

    /* You may assign a chip select identifier to be handled later */
    gas_sensor.dev_id = BME680_I2C_ADDR_PRIMARY;
    gas_sensor.intf = BME680_I2C_INTF;
    gas_sensor.read = i2c_read;
    gas_sensor.write = i2c_write;
    gas_sensor.delay_ms = delay_ms;
    /* amb_temp can be set to 25 prior to configuring the gas sensor
    * or by performing a few temperature readings without operating the gas sensor.
    */
    gas_sensor.amb_temp = 25;


    int8_t rslt = BME680_OK;
    rslt = bme680_init(&gas_sensor);
    printf("BME680 InIt Result: ");
    if(rslt==0)
    {
    printf("Success");
    }
    else
    {
    printf("Error");
    }
    printf("\n");

     

    But I am getting issue at  rslt = bme680_get_regs(BME680_COEFF_ADDR1, coeff_array, BME680_COEFF_ADDR1_LEN, dev);

    in get_calib_data () function. Here Program is stuck and getting  error in I2C reading. But I am getting proper Chip ID 0x61 while reading  chip ID . So I am assuming my I2C lines are working. Also tested with other sensor and confirm I2C line is working.  I have also checked about BME680_COEFF_ADDR1 and that is 0x89 given in bme680_def.h file. But It is not mentioned anywhere in datasheet. 

    Can you please Guide me where I am doing wrong. Please Guide. 

    31 REPLIES 31

    Hello Minhwan,

    I have tried I2C byte by byte reading induvisually instead of multiple byte reading  in shot. I got proper result of Temperature, Humidity, Pressure and Altitude but Gas resistance is getting  zero Now. Can you refer my code and can you guide me if anything I am doing wrong. I have attached here my main.c code here, Please find the attachment. I have made my own functions . You can see also below Output that I am getting. 

    CHIP ID: 97
    Temperature: 27.510000
    Humidity: 50.083008
    Pressure: 951.679993
    Altitude: 525.671021
    Gas: 0.000000

     

    BR

    Sudeep

    Hello Minhwan,

    I have sent code today is modified just for your understand below values

    tempOversampling = 0x05;
    humidOversampling = 0x05; //Setting Humidity Oversampling to factor 16 (default)
    pressOversampling = 0x05; //Setting Pressure Oversampling to factor 16 (default)
    sensorMode = 0x01;
    target_temp =320; // Target Temp 320 degree C
    tempOutsideCelsius=15;
    pressureSeaLevel = 1013.25; //default value of 1013.25 hPa
    IIRfilter=0x04;

     

    Please refer the new attachment. Output is same as shared you in previous message. Temperature, humidity, pressure and altitude values getting  are  correct. Chip Id is also getting correct. 

     

    CHIP ID:  97

    Temperature: 27.299999
    Humidity: 36.500977
    Pressure: 947.539978
    Altitude: 561.994995
    Gas: 0.000000

    Only issue I found that I didnt got new data bit 1 while checking  status of new data in gas measurement. 

    I need to share one thing here, I have just referd one Arduino board code which is working that I have checked with this BME680 sensor that I am using. 

    Same thing I have implemented in this shared code. Now I got same readings of Temperature, Humidity, Pressure, Altitude. But Didnt got Gas resistance value. For Comparision I have collected logic analyser data for both setup. For Arduino and my board. Values I am getting are same no change just in last when I am trying to check status of new data bit while trying to get gas resistance value there I am not getting that new data bit 1. So thats why I am getting return 0 and therefore gas value showing 0.

    Waiting for your reply.

    Minhwan
    Community Moderator
    Community Moderator

    Hello Sudeep, 

     

    Your source code is register based and you made it yourself. I think you need to check it from your side. 

    If you want to use just API, please refer to your latest BME68x API. 

    https://github.com/BoschSensortec/BME68x-Sensor-API

    And, I can provide forced mode logic analyzer log, and you can compare it with yours. 

    Thanks, 

    Minhwan
    Community Moderator
    Community Moderator

    Please check forced mode example data log. 

    Thanks, 

    Hello Minhwan,

     

    As you know I have already tried latest API with forced example. But issue is getting in calibration function where I have stucked just because my I2C max read count is 16. Can you please tell me if my I2C read count is max 16 then can I use API with some modifications? as you know in calibration function I2C reads coefficient registers and it reads 25 addresses at a time. Can I modify there to read one by one instead multiple read at a time? Please guide. 

    I will also refer your logic analyser log to compare with my logic analyser log  of  forced code. 

    Thank you again for your valuable guidance.

    BR

    Sudeep 

    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