Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    Getting error in bme680 calibration function.

    Getting error in bme680 calibration function.



    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; = 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: ");


    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

    Ok. Thanks again for your feedback. I will make changes as per your suggestion. I don't have microsecond delay right now so I will make changes as u suggested. Will give you response soon. 

    Hello Minhwan,

    Sorry for delayed response. I have tested by adding delay 1ms in I2C function . Also I have added logic as per your suggestion as my delay function is 1ms so I have devided it by 1000. Please refer my attachedmodified  common.c  file again. 

    I have stuck again at same place that is in internal calibrationn function.  Please see image below. 


     I am not getting exact issue. Can you suggest me what should be my next step for testing?





    Community Moderator
    Community Moderator

    Hello Sudeep, 


    As long as you can get chip ID data properly, i2c seems working. (Code also okay) 

    But, could you share your logic analyzer data? 

    To sync with mine, could you run and capture \forced_mode example? 

    Please let me know if you have any questions. 




    Hello Minhwan,

    I don't have logic analyzer right now. Will arange PC Based (usb Interace based) logic  analyzer and then can share you its data. 

    I am trying to run forced_mode example code but at same place I have stuck. I am also trying to capture timing diagram during reading Device id from my Oscilloscope but not getting clear capture. Will arrange logic analyser. 

    I have one doubt . Please see below image in which I have marked red

    bme680_forced sample.png

     here SAMPLE _COUNT and coines_get_millis() function is not in library and I assume that It is in coines library so I put some random values just for check.

      Please guide me which values I should put in that place. Soon I will share you logic analyser data. 

    Thanks  you.




    Community Moderator
    Community Moderator

    Hello Sudeep, 


    Yes, please share your logic analyzer log. 

    And, coines function is for our EVM based example code. 

    The forced mode example is to call BME688 temp humidity pressure every 1s. (1000ms) 

    In you case, please ignore the comment. And the time_ms value is correct. 

    Please let me know if you have any questions. 

    Thank you.