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

    Hello Minhwan,

    As you suggested I have captured logic analyser data by running forced example code.  Data shows also execution stucking in internal calibration function.

    I have also given link here to download logic 2.3.44 software in which you can import  .sal file to see all log . All captured data included in zip file attached with this message. 

    Please download the software if needed from here to see .sal file also.

    I have attached captured image files also in zip file.

    In captured log I have seen in internal calibration api in bme68x_get_regs(BME68X_REG_COEFF1, coeff_array, BME68X_LEN_COEFF1, dev) function library defines BME68X_LEN_COEFF1=25 but getting only 16 and after that it is stucking. 

    Pleaase suggest.

    Community Moderator
    Community Moderator

    Hello sudeep, 


    Correct. All logic data is okay before get_calib_data function. 

    I feel that your maximum i2c length could be 16. That's why you can't get over it. 

    Could you check for it? 

    And, BME68X_LEN_COEFF1 is 23, so for this example 24 is enough. 

    Please let me know. 



    Hello Minhwan,

    I have shared here one Image of my BlueNRG2 (BLE with MCU) Module datasheet. In which it is clearly mentioned that my I2C Rx and Tx fifo max size is 16 byte. Please refer the attachment. 

     Please guide me Can I Read one by one registers with  seperate I2C read function for each register instead if multiple read registers in one shot?



    Community Moderator
    Community Moderator

    Hello Sudeep, 


    I will check it with HQ. 

    It will take some time, and let you know if there is any update. 


    Hello Minhwan,

    Thanks. Waiting for your response. Meanwhile I will also try to find some tricks. Please give me reply once you  check  with HQ.