Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    Getting error in bme680 calibration function.

    Getting error in bme680 calibration function.

    Sudeep1310
    Established 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

    Sudeep1310
    Established Member

    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. 

    Sudeep1310
    Established Member

    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. 

    Sudeep1310_0-1643616025419.png

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

     

    BR 

    Sudeep

     

    Minhwan
    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. 

    Thanks, 

     

     

    Sudeep1310
    Established Member

    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.

     

    BR 

    Sudeep

    Minhwan
    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. 

    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