01-26-2021 04:43 PM
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。
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
Solved! Go to Solution.
01-27-2021 02:21 AM
Hello rex,
That's great.
Please let me know if you have further questions.
Thanks,
01-27-2021 02:28 AM
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
01-27-2021 03:54 AM - edited 01-27-2021 03:56 AM
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,
01-27-2021 04:16 AM
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
01-27-2021 07:32 PM
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,