I'm looking at the BME680 datasheet and I have some questions about the following fields:
reg field purpose
|meas_status_0||measuring||Reads as 1 when a TPHG conversion is active and 0 when the results are transferred to the data registers|
|meas_status_0||gas_measuring||Changes to 1 during gas measurement phase and then changes to 0 once the gas measurement has been transferred to the data registers|
|meas_status_0||new_data_0||Is new data available? yes (1), no (0). I believe this is set to 0 when a measurement is initiated by writing 1 to ctrl_meas.mode and thus entering "forced" mode|
|gas_r_lsb||heat_stab_r||Did the heater reach the temperature specified? yes (1), no (0)|
|gas_r_lsb||gas_valid_r||Is the gas data in the register real (1) or dummy (0)|
Is meas_status_0.measuring just an inverted version of meas_status_0.new_data_0? If not, how are they different?
What is the purpose of meas_status_0.gas_measuring? Why would a driver care when the gas measurement is active? Isn't it sufficient to just look at the measuring or new_data_0 fields to know when the whole TPHG cycle is complete?
I believe gas_valid_r indicates whether the value in the data register is a real value or a dummy value. If I set ctrl_gas_1.run_gas=1 before entering forced mode, then why would the value be a dummy? Are the dummy values at all meaningful or are they just garbage that should be discarded?
Solved! Go to Solution.
A lot of information about the sensor's state are available, but it doesn't mean one would want to monitor every single one of them. If you are looking for the end of the measurement sequence, you could pick your preffered source and stick with it.
In typical applications as you described, you would not expect any dummy gas value. As described in the datasheet, dummy values may be inserted by the sensor only to keep a constant sampling rate and predictable device timing.
It is highly recommended to use the official sensor API/drivers from Bosch Sensortec to communicate with the sensor. BME680's sensor API even provides a function called bme680_get_profile_dur(), that can be used to predict the measurement period based on the sensor's configuration. You can find the BME680 drivers here: BME680 sensor API.
To benefit from the IAQ output, you will also need to use the pre-compiled BSEC library available here: BSEC Software download. If you have a look at the sample code available in this package, you will find that it makes use of bme680_get_profile_dur() after triggering a measurement, then ensures the sensor successfully returned to sleep mode before the data read-out operation.