Bosch Sensortec Community

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

    BME680 gas resistanc no output

    BME680 gas resistanc no output

    rex
    Member

    My code is exactly the same as the code here,https://github.com/BoschSensortec/BME680_driver#example-for-reading-all-sensor-data

    But there is a issue, printf (", G: %d ohms", data.gas_resistance); there is no output

    Other data output is normal。

    Reading sensor data

    Example for reading all sensor data

        while(1)
        {
            user_delay_ms(meas_period); /* Delay till the measurement is ready */
    
            rslt = bme680_get_sensor_data(&data, &gas_sensor);
    
            printf("T: %.2f degC, P: %.2f hPa, H %.2f %%rH ", data.temperature / 100.0f,
                data.pressure / 100.0f, data.humidity / 1000.0f );//normal
            /* Avoid using measurements from an unstable heating setup */
            if(data.status & BME680_GASM_VALID_MSK)
                printf(", G: %d ohms", data.gas_resistance);//no output
    
            printf("\r\n");
    
            /* Trigger the next measurement if you would like to read data out continuously */
            if (gas_sensor.power_mode == BME680_FORCED_MODE) {
                rslt = bme680_set_sensor_mode(&gas_sensor);
            }
        }

     

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------

    This is the data I read and write, I use i2c

    write to 0x76 ack data: 0x74
    read to 0x76 ack data: 0x8C
    write to 0x76 ack data: 0x74 0x8D
    write to 0x76 ack data: 0x1D
    read to 0x76 ack data: 0x80 0x00 0x51 0xF7 0x30 0x7B 0x0A 0x50 0x52 0xC5 0x80 0x00 0x00 0x3C 0xB6
    write to 0x76 ack data: 0x74
    read to 0x76 ack data: 0x8C
    write to 0x76 ack data: 0x74 0x8D
    write to 0x76 ack data: 0x1D
    read to 0x76 ack data: 0x80 0x00 0x51 0xF7 0x30 0x7B 0x0A 0x40 0x52 0xC3 0x80 0x00 0x00 0x3B 0x36

     

     

    10 REPLIES 10

    Minhwan
    Community Moderator
    Community Moderator

    Hello rex, 

     

    That's great. 

    Please let me know if you have further questions. 

    Thanks, 

    Hi,minhwan

     

    I currently only have this problem. gas resistanc no output. Can you tell me why there is no output?

    you see my code and I2C communication data, is there any progress?

     

    Thank you

    Minhwan
    Community Moderator
    Community Moderator

    Hello Rex, 

     

    I tested with your code. 

    And, I got gas value. 

    Could you let me know the "meas_period" value? 

    And, could you have one more test? 

    gas_sensor.delay_ms = user_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;

    /// Add below 4 lines. 

    uint8_t addr = 0xE0;
    uint8_t val = 0xB6;
    bme680_set_regs(&addr, &val, 1, &gas_sensor);
    delay(200);

     

    If you still have an issue, I will check your i2c log as well. 

    Thanks, 

    hi, minhwan

    I did what you said, the issue still exists,gas resistanc no output

    -----------------------------------------------------------------------------------------------------------

    gas_sensor.amb_temp = 25;

    -
    + /// Add below 4 lines. -add Community Moderator^M
    +^M
    + uint8_t addr = 0xE0;^M
    + uint8_t val = 0xB6;^M
    + bme680_set_regs(&addr, &val, 1, &gas_sensor);^M
    + user_delay_ms(200);^M
    +^M
    +^M
    int8_t rslt = BME680_OK;
    rslt = bme680_init(&gas_sensor);

    @@ -262,6 +269,8 @@ void bme680_task_process(void){

    user_delay_ms(meas_period); /* Delay till the measurement is ready */

    + NRF_LOG_INFO("%s,meas_period:%d ms\r\n",__FUNCTION__,meas_period); ^M
    + ^M
    rslt = bme680_get_sensor_data(&data, &gas_sensor);

    sprintf(temperature,"%f",data.temperature / 100.0f);

    ----------------------------------------------------------------------------------------------------------

    00> <info> app: bme680_task_process,meas_period:183 ms
    00> <info> app: bme680_task_process,temperature:25.150000 degC
    00> <info> app: bme680_task_process,pressure:1018.190002 hPa
    00> <info> app: bme680_task_process,humidity:43.988998 rH

    ----------------------------------------------------------------------------------------------------------

    write to 0x76 ack data: 0xE0 0xB6
    write to 0x76 ack data: 0xE0 0xB6
    write to 0x76 ack data: 0xD0
    read to 0x76 ack data: 0x61
    write to 0x76 ack data: 0x89
    read to 0x76 ack data: 0x80 0x4D 0x67 0x03 0x30 0x24 0x8D 0x90 0xD7 0x58 0x00 0xE4 0x1E 0x6E 0xFF 0x1F 0x1E 0x00 0x00 0x09 0xFB 0xA8 0xF3 0x1E 0x7F
    write to 0x76 ack data: 0xE1
    read to 0x76 ack data: 0x3F 0xE7 0x2C 0x00 0x2D 0x14 0x78 0x9C 0xC2 0x66 0xBD 0xE6 0xDF 0x12 0x9D 0x00
    write to 0x76 ack data: 0x02
    read to 0x76 ack data: 0x16
    write to 0x76 ack data: 0x00
    read to 0x76 ack data: 0x2F
    write to 0x76 ack data: 0x04
    read to 0x76 ack data: 0x03
    write to 0x76 ack data: 0x5A 0x81 0x64 0x65
    write to 0x76 ack data: 0x74
    read to 0x76 ack data: 0x00
    write to 0x76 ack data: 0x75
    read to 0x76 ack data: 0x00
    write to 0x76 ack data: 0x74
    read to 0x76 ack data: 0x00
    write to 0x76 ack data: 0x72
    read to 0x76 ack data: 0x00
    write to 0x76 ack data: 0x71
    read to 0x76 ack data: 0x00
    write to 0x76 ack data: 0x75 0x08 0x74 0x8C 0x72 0x02 0x71 0x10
    write to 0x76 ack data: 0x74
    read to 0x76 ack data: 0x8C
    write to 0x76 ack data: 0x74 0x8D
    write to 0x76 ack data: 0x1D
    read to 0x76 ack data: 0x80 0x00 0x51 0x4F 0x40 0x7A 0x14 0x80 0x4E 0x2D 0x80 0x00 0x00 0x3F 0xA5
    write to 0x76 ack data: 0x74
    read to 0x76 ack data: 0x8C
    write to 0x76 ack data: 0x74 0x8D
    write to 0x76 ack data: 0x1D
    read to 0x76 ack data: 0x80 0x00 0x51 0x55 0x90 0x7A 0x2A 0x10 0x4E 0x33 0x80 0x00 0x00 0x16 0x38
    write to 0x76 ack data: 0x74
    read to 0x76 ack data: 0x8C
    write to 0x76 ack data: 0x74 0x8D
    write to 0x76 ack data: 0x1D
    read to 0x76 ack data: 0x80 0x00 0x51 0x55 0xA0 0x7A 0x2A 0x90 0x4E 0x25 0x80 0x00 0x00 0x69 0xF7
    write to 0x76 ack data: 0x74
    read to 0x76 ack data: 0x8C
    write to 0x76 ack data: 0x74 0x8D
    write to 0x76 ack data: 0x1D
    read to 0x76 ack data: 0x80 0x00 0x51 0x55 0xA0 0x7A 0x2A 0xC0 0x4E 0x18 0x80 0x00 0x00 0x3E 0xF7
    write to 0x76 ack data: 0x74
    read to 0x76 ack data: 0x8C
    write to 0x76 ack data: 0x74 0x8D
    write to 0x76 ack data: 0x1D
    read to 0x76 ack data: 0x80 0x00 0x51 0x55 0xA0 0x7A 0x2B 0x20 0x4E 0x0F 0x80 0x00 0x00 0x28 0x77
    write to 0x76 ack data: 0x74
    read to 0x76 ack data: 0x8C
    write to 0x76 ack data: 0x74 0x8D
    write to 0x76 ack data: 0x1D
    read to 0x76 ack data: 0x80 0x00 0x51 0x56 0x00 0x7A 0x2B 0x60 0x4E 0x05 0x80 0x00 0x00 0x1E 0xB7
    write to 0x76 ack data: 0x74
    read to 0x76 ack data: 0x8C
    write to 0x76 ack data: 0x74 0x8D
    write to 0x76 ack data: 0x1D
    read to 0x76 ack data: 0x80 0x00 0x51 0x56 0x40 0x7A 0x2B 0x70 0x4E 0x00 0x80 0x00 0x00 0x17 0xB7
    write to 0x76 ack data: 0x74
    read to 0x76 ack data: 0x8C
    write to 0x76 ack data: 0x74 0x8D

     

     

     

     

     

     

     

     

    Minhwan
    Community Moderator
    Community Moderator

    Hello Rex, 

     

    In your log, technically, you already got gas resistance as below. 

    write to 0x76 ack data: 0x1D
    read to 0x76 ack data: 0x80 0x00 0x51 0x4F 0x40 0x7A 0x14 0x80 0x4E 0x2D 0x80 0x00 0x00 0x3F 0xA5

    read_field_data could be good starting point to check your data, below code is the code to get data. 

    rslt = bme680_get_regs(((uint8_t) (BME680_FIELD0_ADDR)), buff, (uint16_t) BME680_FIELD_LENGTH,dev);

    Please check it first. 

    Thanks, 

    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