Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BME680 BSEC next call equal to time stamp, and some values are 0

    BME680 BSEC next call equal to time stamp, and some values are 0

    faskrobo
    Member

    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);
    }

     

    3 REPLIES 3

    BSTRobin
    Community Moderator
    Community Moderator

    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...

    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.

    BSTRobin
    Community Moderator
    Community Moderator

    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...

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist