08-20-2021 09:07 PM
In bsec_iot_loop, time_stamp is set to the current time in nanoseconds and passed into bsec_sensor_control. However, when bsec_sensor_control returns, sensor_settings.next_call is set equal to time_stamp, which means the wait interval at the end of the loop ends up negative! I can't access bsec_sensor_control either since it is closed source. Why is it returning a next_call value as if it expects the execution to be instantaneous? I suspect this problem may be related to the fact that the outputs I get for iaq, compensated humidity, and other non-raw air/gas quality values are all 0?
P.S. This is unrelated to the above but in debugging a different issue I found a very strange piece of code in bme680_set_regs in the file bme680.c which seems like a BSEC bug. From what I've seen it looks like other people may have had their sensor operation impaired by this code as well. From lines 354-358:
if (rslt == BME680_OK) {
dev->com_rslt = dev->write(dev->dev_id, tmp_buff[0], &tmp_buff[1], (2 * len) - 1);
if (dev->com_rslt != 0)
rslt = BME680_E_COM_FAIL;
}
This takes a buffer that alternates addresses and data values, and treats it instead like a single address with 5 data values afterward. Here's my modification, which fixed an issue where humidity measurement was disabled:
dev->com_rslt = 0;
for (index = 0; index < len; index++) {
dev->com_rslt |= dev->write(dev->dev_id, tmp_buff[2*index], &tmp_buff[2*index + 1], 1);
}
08-23-2021 09:25 AM
Hello faskrobo,
The driver code on website was verified.
There was reference code in the following ticket, you could refer it and check your code first.
https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BME680-with-BSEC-produces-on-0-0s-even-a...
08-23-2021 05:44 PM - edited 08-23-2021 05:46 PM
I found out that the write function doesn't work when it is implemented by sending bytes one at a time, which is what I was doing. That resolved the second issue. However, I am still getting BSEC_W_SC_CALL_TIMING_VIOLATION due to the next_call field being set equal to the timestamp, and the outputs previously mentioned are still shown as 0. I checked all of the functions in the code provided and they seem very similar to my implementations.
09-26-2021 11:13 AM
Hello faskrobo,
The following code works well, you could strictly compare it with your code.
https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BME680-with-BSEC-produces-on-0-0s-even-a...