12-14-2019 06:42 AM - edited 12-14-2019 06:43 AM
Hi,
I'd like confirmation of a probable bug in the BSEC_integration.c file, in the bsec_iot_init function. It reads:
return_values_init bsec_iot_init(uint8_t deviceAddr, float sample_rate, float temperature_offset, bme680_com_fptr_t bus_write, bme680_com_fptr_t bus_read, sleep_fct sleep, state_load_fct state_load, config_load_fct config_load) { return_values_init ret = {BME680_OK, BSEC_OK}; bsec_library_return_t bsec_status = BSEC_OK; uint8_t bsec_state[BSEC_MAX_PROPERTY_BLOB_SIZE] = {0}; // <--- BUG uint8_t bsec_config[BSEC_MAX_PROPERTY_BLOB_SIZE] = {0}; uint8_t work_buffer[BSEC_MAX_PROPERTY_BLOB_SIZE] = {0}; // <--- BUG int bsec_state_len, bsec_config_len;
and I'm pretty sure it should read:
return_values_init bsec_iot_init(uint8_t deviceAddr, float sample_rate, float temperature_offset, bme680_com_fptr_t bus_write, bme680_com_fptr_t bus_read, sleep_fct sleep, state_load_fct state_load, config_load_fct config_load) { return_values_init ret = {BME680_OK, BSEC_OK}; bsec_library_return_t bsec_status = BSEC_OK; uint8_t bsec_state[BSEC_MAX_STATE_BLOB_SIZE] = {0}; // <--- BUG fixed uint8_t bsec_config[BSEC_MAX_PROPERTY_BLOB_SIZE] = {0}; uint8_t work_buffer[BSEC_MAX_WORKBUFFER_SIZE] = {0}; // <--- BUG fixed int bsec_state_len, bsec_config_len;
Please let me know if this is indeed a bug. My app was crashing before the bug fix and is working now after the above fix.
It was crashing because bsec_iot_init was calling state_load with the wrong buffer size and the subsequent call to bsec_set_state was failing.
If this is confirmed to be a bug, how is it possible that no one else has discovered and reported this problem in the past two years?
Thank you,
Kevin
Solved! Go to Solution.
12-19-2019 02:56 AM
Hi Kevin,
Thank you very much for feedback this informtion to us.It is already sent back to the internal team for analysis.
12-19-2019 05:38 AM
Thanks Shelly. Could you let me know if the software engineers confirm this is infact a bug? I'm pretty sure it is. Thank you!
12-19-2019 11:28 AM - edited 12-19-2019 11:30 AM
You are correct, work buffer arrays should be of size BSEC_MAX_WORKBUFFER_SIZE, and state arrays (respectively config arrays) should be of size BSEC_MAX_STATE_BLOB_SIZE (respectively BSEC_MAX_PROPERTY_BLOB_SIZE).
12-19-2019 07:15 PM - edited 12-19-2019 07:17 PM
OK. Thanks. I'm a little puzzled why Bosch has made it such a challenge to integrate this sensor into a design. As it stands now, I've had to "plug in" 12 Bosch sensor C files into my application just to read the IAQ. I would think it should be way easier to implement this part: One or two files with just a few entry points to call into the functions, or better yet just read the IAQ right off the sensor itself after it calculates the value... I have things working finally but it has taken way more time than I think it should have. Just a friendly note from out here in the field...