Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    Problem BSEC 2.4.0.0 with BSEC_SAMPLE_RATE_LP

    Problem BSEC 2.4.0.0 with BSEC_SAMPLE_RATE_LP

    edodm85
    New Poster

    Hi,

    I have a problem with the library BSEC 2.4.0.0 initialized with "BSEC_SAMPLE_RATE_LP".

    I'm using IAR with a BME688 connected via I2C to a nucleo-l432kc board.

    If I use BSEC_SAMPLE_RATE_SCAN with these subscribes {
    BSEC_OUTPUT_RAW_GAS_INDEX,
    BSEC_OUTPUT_RAW_TEMPERATURE,
    BSEC_OUTPUT_RAW_PRESSURE,
    BSEC_OUTPUT_RAW_HUMIDITY,
    BSEC_OUTPUT_RAW_GAS,
    BSEC_OUTPUT_GAS_ESTIMATE_1,
    BSEC_OUTPUT_GAS_ESTIMATE_2,
    BSEC_OUTPUT_GAS_ESTIMATE_3,
    BSEC_OUTPUT_GAS_ESTIMATE_4

    it works correctly.

     

    But when I use BSEC_SAMPLE_RATE_LP with these subscribes {
    BSEC_OUTPUT_IAQ,
    BSEC_OUTPUT_RAW_TEMPERATURE,
    BSEC_OUTPUT_RAW_PRESSURE,
    BSEC_OUTPUT_RAW_HUMIDITY,
    BSEC_OUTPUT_RAW_GAS,
    }

    I have this warning in "bsec_sensor_control": BSEC_W_SC_CALL_TIMING_VIOLATION and all output (T, H, P, IAQ) is zero.

     

     

    I attach two screens:

    - 1: initialization is with BSEC_SAMPLE_RATE_SCAN

    - 2: initialization is with BSEC_SAMPLE_RATE_LP

     

    Thanks,

    Edo

     

     

    2 REPLIES 2

    Prop4et
    Established Member

    Hi Edo,

    from the BSEC documentation it is stated that the  BSEC_W_SC_CALL_TIMING_VIOLATION error is returned when "The timestamp at which bsec_sensor_control(timestamp) is called differs from the target timestamp which was returned during the previous call in the .next_call struct member by more than 6.25%".

    The BSEC_SAMPLE_RATE_SCAN is defined as 0.055556f, so the frequency is 1/18Hz, so basically it samples every 18 seconds while the BSEC_SAMPLE_RATE_LP is  0.33333f and the frequency is 1/3Hz, so the samples are every 3 seconds. I'm afraid that by calling the tick function and saving the value to a variable that is then passed to the bsec_sensor_control() function wastes enough time in case of LP to get you outside of the 6.25% margin, while it keeps you in the margin for the 18 seconds interval. 
    Try to call the tick function inside bsec_sensor_control and let me know if this was the problem or if i got it wrong.

    Francesco

    Thanks for reply Francesco.

    I found a bug in my code and now the warning BSEC_W_SC_CALL_TIMING_VIOLATION is fixed and the output is non-zero.

    Edo

    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