Bosch Sensortec Community

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

    BME680 temperature value is always 0 after calc_temperature() is called

    BME680 temperature value is always 0 after calc_temperature() is called

    wenwenchen
    Member

    I use a bme680 for my project, but the temperature value from `read_field_data()` is always 0 .

    I printed the following debug data for this code part https://github.com/BoschSensortec/BME680_driver/blob/master/bme680.c#L1223-L1239

    buf[5-7] is 129 105 96
    adc_temp is 530070, adc_pres is 393660, adc_hum is 14457, adc_gas_res is 304 and adc_gas range is 5
    after calculation:

    data->temperature = 0.000
    data->humidity = 20.270
    data->pressure =95598.000
    data->gas_resistance = 294021.0

    buf[5-7] is 130 140 32
    adc_temp is 534722, adc_pres is 414452, adc_hum is 13726, adc_gas_res is 377 and adc_gas range is 5
    after calculation:

    data->temperature = 0.000
    data->humidity = 16.673
    data->pressure = 92113.000
    data->gas_resistance = 276157.0

     

    Can somebody help me?

    10 REPLIES 10

    handytech
    Community Moderator
    Community Moderator

    Unfortunately there are no built-in functions to dump the whole register map. Please insert your own debug print functions at the relevant locations in your code, or use burst read functions to read-out the whole register map range.

    Hi,

    I tested the sensor with esp32 using the simily code like https://github.com/BoschSensortec/BME680_driver/blob/master/Self%20test/bme680_selftest.c, it works perfectly, then I used the (almost) same code running on raspberry, unfortunetely, it does not work properly.

     

    Did you test the sensor with a raspberry using I2c? If not, can you please test it? Here some debug output of my test setup:

     

    first:
    get dur
    delay 183 ms
    get data
    read from pid 5
    r: 1d:0080008000800800004
    read from pid 5
    r: 1d:0080008000800800004
    read from pid 5
    r: 1d:0080008000800800004
    read from pid 5
    r: 1d:0080008000800800004
    read from pid 5
    r: 1d:0080008000800800004
    read from pid 5
    r: 1d:0080008000800800004
    read from pid 5
    r: 1d:0080008000800800004
    read from pid 5
    r: 1d:0080008000800800004
    read from pid 5
    r: 1d:0080008000800800004
    read from pid 5
    r: 1d:0080008000800800004
    Error [2] : Unknown error code
    T: -5.68 degC, P: 0.06 hPa, H 1993407.88 %rH
    set sensor_mode
    read from pid 5
    r: 74:0
    w: 74:1
    w: 74:1
    write to from pid 5
    second:
    get dur
    delay 183 ms
    get data
    read from pid 5
    r: 1d:005a68807d9ba0445f800088ba
    read from pid 5
    r: 1d:005a68807d9ba0445f800088ba
    read from pid 5
    r: 1d:005a68807d9ba0445f800088ba
    read from pid 5
    r: 1d:005a68807d9ba0445f800088ba
    read from pid 5
    r: 1d:005a68807d9ba0445f800088ba
    read from pid 5
    r: 1d:005a68807d9ba0445f800088ba
    read from pid 5
    r: 1d:005a68807d9ba0445f800088ba
    read from pid 5
    r: 1d:005a68807d9ba0445f800088ba
    read from pid 5
    r: 1d:005a68807d9ba0445f800088ba
    read from pid 5
    r: 1d:005a68807d9ba0445f800088ba
    Error [2] : Unknown error code
    T: -5.68 degC, P: 0.07 hPa, H 1993407.88 %rH , G: 92860 ohms
    set sensor_mode
    read from pid 5
    r: 74:8c
    w: 74:8d
    w: 74:8d
    write to from pid 5

     

    In attachment, you can also find the debug output from my osciloscopy.

    And what I just wonder, after setting Baudrate to 40000 in raspberry, one of bme680 sensor in our project, it works well, but a second on board not. If you like to know more, you can also write me email to wenwen.chen@de.bosch.com

    I spend another day to debug and find out the problem: After soft resetting, I am not able to set value to any register. I checked with osciloscope, the I2c communication looks good and there is no error reported by i2c driver. Here some more logs:

    w: 0xe0: 0xb6
    r: 0xe0: 0x0
    r: 0xd0: 0x61
    r: 0x89: 0x0 0xd2 0x66 0x3 0x30 0x7a 0x8d 0x70 0xd7 0x58 0x0 0x1c 0x23
    0x67 0xff 0x29 0x1e 0x0 0x0 0xd 0xf6 0xb2 0xf5 0x1e 0x9b
    r: 0xe1: 0x41 0x57 0x24 0x0 0x2d 0x14 0x78 0x9c 0x1d 0x66 0x3d 0xe2 0xdf
    0x12 0x16 0x0
    r: 0x2: 0x16
    r: 0x0: 0x20
    r: 0x4: 0x23
    set sensor_mode
    r: 0x74: 0x0
    r: 0x74: 0x0
    set settings
    w: 0x74: 0x0
    r: 0x74: 0x0
    r: 0x72: 0x0
    w: 0x72: 0x2
    r: 0x72: 0x0
    r: 0x75: 0x0
    r: 0x74: 0x0
    r: 0x72: 0x0
    r: 0x71: 0x0
    w: 0x75: 0x8
    r: 0x75: 0x0
    w: 0x74: 0x8c
    r: 0x74: 0x0
    w: 0x72: 0x2
    r: 0x72: 0x0
    w: 0x71: 0x10
    r: 0x71: 0x0
    r: 0x70: 0x0 0x0 0x0 0x0 0x0 0x0
    r: 0x5a: 0x0
    r: 0x64: 0x0
    set settings again
    w: 0x74: 0x0
    r: 0x74: 0x0
    r: 0x72: 0x0
    w: 0x72: 0x2
    r: 0x72: 0x0
    w: 0x5a: 0x79
    r: 0x5a: 0x0
    w: 0x64: 0x65
    r: 0x64: 0x0
    r: 0x74: 0x0
    r: 0x75: 0x0
    r: 0x74: 0x0
    r: 0x72: 0x0
    r: 0x71: 0x0
    w: 0x75: 0x0
    r: 0x75: 0x0
    w: 0x74: 0x0
    r: 0x74: 0x0
    w: 0x72: 0x0
    r: 0x72: 0x0
    w: 0x71: 0x0
    r: 0x71: 0x0
    r: 0x70: 0x0 0x0 0x0 0x0 0x0 0x0
    r: 0x5a: 0x0
    r: 0x64: 0x0
    set sensor_mode
    r: 0x74: 0x0
    w: 0x74: 0x1
    r: 0x74: 0x0
    r: 0x74: 0x0

     

    The bme680 python library https://github.com/pimoroni/bme680-python works direcly on my raspberry. But I can not understand, why the c code not.

    Vincent
    Community Moderator
    Community Moderator

    Good to know you solve the issue. 

    With your source code, we may able to check what happened in C level on this platform.  

    Actually, I need the bme680 also work with c code, because our code is written in c and it still does not work!

     

    Pls contact me via email/skype/teams (wenwen.chen@de.bosch.com) for a bug session.

    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