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

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?

Best reply by wenwenchen

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.

View original
10 replies
Resolved