Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMI270 API (bme2.c) FIFO Bug

    bront
    New Poster

    BMI270 API (bme2.c) FIFO Bug

    I'm using the BMI270 API found here with a known working hardware platform. In this configuration I'm using the FIFO in header-less mode with both Accelerometr and Gyroscope data being collected. My code is based on the example of this type and I have an issue where the last accelerometer sample is not being retrieved by the bmi2_extract_accel function from the FIFO frame. The extraction function repeatedly calls the check_dummy_frame function shown below. 37 bytes are read from the FIFO with the first being a dummy. When extracting the acceleration the the data_index is set to 31 on the 3rd acceleration sample. This sample resides in bytes 31:36 (6 bytes). The logic in the below function below fails but should instead say if(((*data_index) + 6) <= fifo->length)

    check_dummy.PNG

    3 REPLIES 3
    BSTRobin
    Community Moderator

    Re: BMI270 API (bme2.c) FIFO Bug

    Hi bront,

    As you enable accel and gyro, set the FIFO in header-less mode, FIFO data length should be 6 bytes every frame, total FIFO length should be an integer multiple of 6 bytes. FIFO length 37 didn't match it.
    With BMI270 github code, I run FIFO watermark interrupt code and get correct result for your reference. https://github.com/BoschSensortec/BMI270-Sensor-API

    BMI270 acc&gyro FIFO watermark interrupt.png

    bront
    New Poster

    Re: BMI270 API (bme2.c) FIFO Bug

    Robin,

    Which example are you using? My code is based off of the FIFO Headerless Watermark example (https://github.com/BoschSensortec/BMI270-Sensor-API/blob/master/bmi270_examples/fifo_watermark_heade...). The numbers in this example wouldn't yield 100 samples of each sensor. The image below is from the linked example, (6 + 6) * 54  = 648 not 650. Is this some sort of padding to make the driver work correctly?

    Capture.PNG

    BSTRobin
    Community Moderator

    Re: BMI270 API (bme2.c) FIFO Bug

    Hi bront,

    Previous attached code refer both github FIFO header and headerless example code, some modifications have been made based on the example code, like ODR, using hardware interrupt.

    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