Closed bastianhjaeger closed 4 years ago
Hmmm... Could you print contents of dev->calib_data (bme680_calib_data_t)
for esp32?
Interesting idea. My code from the esp8266 and the esp32 only differ by the pins.
Not sure it there need to be more. But you are right.
BME680 Sensor: 0.00 °C, 0.00 %, 0.00 hPa, 14696.00 Ohm
sensor.calib_data.par_t1: 0
sensor.calib_data.par_t2: 0
sensor.calib_data.par_t3: 0
sensor.calib_data.par_p1: 0
sensor.calib_data.par_p2: 0
sensor.calib_data.par_p3: 0
sensor.calib_data.par_p4: 0
sensor.calib_data.par_p5: 0
sensor.calib_data.par_p7: 0
sensor.calib_data.par_p6: 0
sensor.calib_data.par_p8: 0
sensor.calib_data.par_p9: 0
sensor.calib_data.par_p10: 0
sensor.calib_data.par_h1: 0
sensor.calib_data.par_h2: 0
sensor.calib_data.par_h3: 0
sensor.calib_data.par_h4: 0
sensor.calib_data.par_h5: 0
sensor.calib_data.par_h6: 0
sensor.calib_data.par_h7: 0
sensor.calib_data.par_gh1: 0
sensor.calib_data.par_gh2: 0
sensor.calib_data.par_gh3: 0
sensor.calib_data.t_fine: 0
sensor.calib_data.res_heat_range: 1
sensor.calib_data.res_heat_val: 40
sensor.calib_data.range_sw_err: 1
On the ESP8266 it looks like this:
BME680 Sensor: 26.27 °C, 53.63 %, 0.00 hPa, 7098.00 Ohm
sensor.calib_data.par_t1: 26046
sensor.calib_data.par_t2: 26464
sensor.calib_data.par_t3: 3
sensor.calib_data.par_p1: 36756
sensor.calib_data.par_p2: -10489
sensor.calib_data.par_p3: 88
sensor.calib_data.par_p4: 7111
sensor.calib_data.par_p5: -73
sensor.calib_data.par_p7: 52
sensor.calib_data.par_p6: 30
sensor.calib_data.par_p8: -3839
sensor.calib_data.par_p9: -2109
sensor.calib_data.par_p10: 30
sensor.calib_data.par_h1: 685
sensor.calib_data.par_h2: 1027
sensor.calib_data.par_h3: 0
sensor.calib_data.par_h4: 45
sensor.calib_data.par_h5: 20
sensor.calib_data.par_h6: 120
sensor.calib_data.par_h7: -100
sensor.calib_data.par_gh1: -50
sensor.calib_data.par_gh2: -6339
sensor.calib_data.par_gh3: 18
sensor.calib_data.t_fine: 134478
sensor.calib_data.res_heat_range: 1
sensor.calib_data.res_heat_val: 41
sensor.calib_data.range_sw_err: 15
So what can this mean?
Calibration data seems to be read or interpreted incorrectly.
Could you dump contents of uint8_t buf[BME680_CDM_SIZE]
(bme680_init_sensor()) after reading it at line 580 in bme680.c?
Interesting. It seems like the dumping between the i2c readings solves the problem. See the screenshot. As soon as I remove the buffer dumping, the problem appears again.
Here the interim result. I will investigate this later today.
Code:
ESP32 result:
#0 dump uint8_t buf[BME680_CDM_SIZE]
0x30 0x0d 0x80 0x30 0x7f 0xfb 0x3f 0x60 0x7f 0xfb 0x3f 0x40 0x42 0x0f 0x00 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xd2 0x8a 0x08 0x80 0x10 0x57 0xfb 0x3f 0xa8 0x23 0xfb 0x3f 0x4c 0x64 0xfb 0x3f 0x50 0x58
48 13 128 48 127 251 63 96 127 251 63 64 66 15 0 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 210 138 8 128 16 87 251 63 168 35 251 63 76 100 251 63 80 88
#1 dump uint8_t buf[BME680_CDM_SIZE]
0x80 0x60 0x67 0x03 0x0f 0x94 0x8f 0x07 0xd7 0x58 0xff 0xc7 0x1b 0xb7 0xff 0x34 0x1e 0x00 0x00 0x01 0xf1 0xc3 0xf7 0x1e 0x01 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xd2 0x8a 0x08 0x80 0x10 0x57 0xfb 0x3f 0xa8 0x23 0xfb 0x3f 0x4c 0x64 0xfb 0x3f 0x50 0x58
128 96 103 3 15 148 143 7 215 88 255 199 27 183 255 52 30 0 0 1 241 195 247 30 1 165 165 165 165 165 165 210 138 8 128 16 87 251 63 168 35 251 63 76 100 251 63 80 88
#2 dump uint8_t buf[BME680_CDM_SIZE]
0x80 0x60 0x67 0x03 0x0f 0x94 0x8f 0x07 0xd7 0x58 0xff 0xc7 0x1b 0xb7 0xff 0x34 0x1e 0x00 0x00 0x01 0xf1 0xc3 0xf7 0x1e 0x01 0x40 0x3d 0x2a 0x00 0x2d 0x14 0x78 0x9c 0xbe 0x65 0x3d 0xe7 0xce 0x12 0x5b 0x00 0xfb 0x3f 0x4c 0x64 0xfb 0x3f 0x50 0x58
128 96 103 3 15 148 143 7 215 88 255 199 27 183 255 52 30 0 0 1 241 195 247 30 1 64 61 42 0 45 20 120 156 190 101 61 231 206 18 91 0 251 63 76 100 251 63 80 88
#3 dump uint8_t buf[BME680_CDM_SIZE]
0x80 0x60 0x67 0x03 0x0f 0x94 0x8f 0x07 0xd7 0x58 0xff 0xc7 0x1b 0xb7 0xff 0x34 0x1e 0x00 0x00 0x01 0xf1 0xc3 0xf7 0x1e 0x01 0x40 0x3d 0x2a 0x00 0x2d 0x14 0x78 0x9c 0xbe 0x65 0x3d 0xe7 0xce 0x12 0x5b 0x00 0x29 0xaa 0x16 0xcb 0xf3 0xfc 0x62 0x67
128 96 103 3 15 148 143 7 215 88 255 199 27 183 255 52 30 0 0 1 241 195 247 30 1 64 61 42 0 45 20 120 156 190 101 61 231 206 18 91 0 41 170 22 203 243 252 98 103
W (330) BME680: Heater is not stable
ESP8266:
#0 dump uint8_t buf[BME680_CDM_SIZE]
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x50 0xcd 0xfe 0x3f 0x6d 0x24 0x21 0x40 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xf0 0xcb 0xfe 0x3f 0x8c 0x24 0x21 0x40 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xf0 0xcb 0xfe 0x3f 0x84 0xdc 0x21 0x40 0xa5 0xa5
0 0 0 0 0 0 0 80 205 254 63 109 36 33 64 0 0 0 0 0 0 0 0 240 203 254 63 140 36 33 64 165 165 165 165 165 165 165 165 240 203 254 63 132 220 33 64 165 165
#1 dump uint8_t buf[BME680_CDM_SIZE]
0x40 0xe6 0x66 0x03 0x2f 0x64 0x91 0xdc 0xd6 0x58 0xff 0x4e 0x20 0x75 0xff 0x3b 0x1e 0x00 0x00 0x83 0xed 0x32 0xf9 0x1e 0x02 0xfe 0x3f 0x8c 0x24 0x21 0x40 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xa5 0xf0 0xcb 0xfe 0x3f 0x84 0xdc 0x21 0x40 0xa5 0xa5
64 230 102 3 47 100 145 220 214 88 255 78 32 117 255 59 30 0 0 131 237 50 249 30 2 254 63 140 36 33 64 165 165 165 165 165 165 165 165 240 203 254 63 132 220 33 64 165 165
#2 dump uint8_t buf[BME680_CDM_SIZE]
0x40 0xe6 0x66 0x03 0x2f 0x64 0x91 0xdc 0xd6 0x58 0xff 0x4e 0x20 0x75 0xff 0x3b 0x1e 0x00 0x00 0x83 0xed 0x32 0xf9 0x1e 0x02 0x40 0xe1 0x27 0x00 0x2d 0x14 0x78 0x9c 0x50 0x66 0x49 0xe7 0xc9 0x12 0x5b 0x00 0xfe 0x3f 0x84 0xdc 0x21 0x40 0xa5 0xa5
64 230 102 3 47 100 145 220 214 88 255 78 32 117 255 59 30 0 0 131 237 50 249 30 2 64 225 39 0 45 20 120 156 80 102 73 231 201 18 91 0 254 63 132 220 33 64 165 165
#3 dump uint8_t buf[BME680_CDM_SIZE]
0x40 0xe6 0x66 0x03 0x2f 0x64 0x91 0xdc 0xd6 0x58 0xff 0x4e 0x20 0x75 0xff 0x3b 0x1e 0x00 0x00 0x83 0xed 0x32 0xf9 0x1e 0x02 0x40 0xe1 0x27 0x00 0x2d 0x14 0x78 0x9c 0x50 0x66 0x49 0xe7 0xc9 0x12 0x5b 0x00 0x28 0xaa 0x16 0x4c 0x13 0x03 0x66 0x6c
64 230 102 3 47 100 145 220 214 88 255 78 32 117 255 59 30 0 0 131 237 50 249 30 2 64 225 39 0 45 20 120 156 80 102 73 231 201 18 91 0 40 170 22 76 19 3 102 108
W (510) BME680: Heater is not stable
Same code on both devices. Same sensor device used for both tests.
@UncleRus I found a "fix" with all your hints.
Increasing BME680_RESET_PERIOD
from 5 to 10 ms
or
adding an extra 10 ms delay before the read calls (i2c_dev_read_reg(..)
) around line 582 of bme680.c helps.
Great! Thank you!
Device type
Framework version
Describe the bug I am seeing different results running the BME680 example code on an ESP12f and ESP32. Siee los attached.
Both chips recognize the sensor via I2C, but the ESP32 keeps converting the RAW data to zero
The ESP12f on the other hand works fine:
The BME is powerd by 3.3V from the board. I an not sure if there could be something in the sdkconfig that messes up the configuration of the sensor / i2c, but I can not imagine what that would be.
sdkconfig.defaults.esp12f.txt sdkconfig.defaults.esp32.txt esp12f.log esp32.log