Bosch Sensortec Community

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

    BMI270 gyro scaling incorrect if using FIFO with prefiltered data

    BMI270 gyro scaling incorrect if using FIFO with prefiltered data

    etracer
    Established Member

    First let me start by saying in my application I'm not using the API and have implemented my own driver. Everything is working properly when not using the FIFO. However we want to utilize the 6.4KHz ODR and this requires using the FIFO and prefiltered data. The problem I'm seeing is that when we choose filtered data for the FIFO (FIFO_DOWNS = 0x88) the data is correct and the GYRO_RANGE of +=2000dps (GYRO_RANGE = 0x00) works as expected (and matches the behavior when doing direct register reads instead of using the FIFO).

    However when switching to prefiltered data (FIFO_DOWNS = 0x00) to get the 6.4KHz ODR the GYRO_RANGE seems to be ignored and the data behaves as if the range is +-250dps (as if GYRO_RANGE was set to 0x03) even though it's set to 0x00 (and verified by reading the register back). So instead of 16.4 LSB/dps it's behaving like 131.2 LSB/dps. This is unworkable in our application as we need the full +-2000dps scale.

    Everything else behaves as expected. The ODR in the FIFO is 3.2KHz when using filtered and 6.4KHz when prefilitered as it should. It's just the GYRO_RANGE and the full-range scaling that seems to be misbehaving.

    In this test case the FIFO was configured for headerless mode and only the gyro data was enabled (FIFO_CONFIG_1 = 0x80).

    So to recap, the gyro data in the FIFO behaves normally if it's configured to be filtered data. However when set to be prefiltered data the scaling is incorrect and seems to be behaving like GYRO_RANGE = 0x03 (+-250dps) even though it's set to 0x00 (+-2000dps).

    Any thoughts?

    9 REPLIES 9

    Hi etracer,

    I am also implementing  my own API, with regards to FIFO, if only gyro is used, (and this is not clear to me) what should be read offset in the FIFO.

    If AUX is enabled, then gyro offset is 8 (as in datasheet) . Sorry not starting a new thread on the FIFO here.

    etracer
    Established Member

    @pr1 wrote:

    Hi etracer,

    I am also implementing  my own API, with regards to FIFO, if only gyro is used, (and this is not clear to me) what should be read offset in the FIFO.

    If AUX is enabled, then gyro offset is 8 (as in datasheet) . Sorry not starting a new thread on the FIFO here.


    If you're using headerless mode and only have gyro data in the FIFO (FIFO_CONFIG_1 = 0x80) then there is no offset. Just the 6 byte frames of the gyro axis data.

    Thank you, yes that is correct. I have only gyro data and bytes 0-5 have the first x,y,z of the gyro data.

    I have another question though.

    The FIFO is set in overwrite mode, and everytime I check the length it is 230.

    What is 230 ? Is it the number of frames ?

    IS this the number of frames then 230x6=1380 bytes. The FIFO is supposed to be 2 KB.

    Is the FIFO lenght correct and 230 is the number of frames (on frame is one x,y,z tuple - 6 bytes) ?

    This is the fifo len method

    #define BMI2_GET_BIT_POS0(reg_data, bitname) (reg_data & (bitname))
    u8 bosch_imu_bmi270::bmi2_get_fifo_length(uint16_t *fifo_length, int busfd)
    {
    u8 rslt;

    u8 index = 0;

    u8 data[2] = { 0 }; // MSB-1 LSB-0
     
     
    /* Read FIFO length */
    rslt = this->read_register(busfd,0x24,data,1);
     
    if (rslt==1){
     
    data[index] = BMI2_GET_BIT_POS0(data[1], UINT8_C(0x3F)); //0x3f mask
    (*fifo_length) = ((data[index] << 8) | data[index - 1]);
    printf("fifo len is %d\n",*fifo_length);
     
    }
     
    return rslt;
    }

    etracer
    Established Member

    The FIFO length is the number of bytes available in the FIFO - not the number of "frames". So in the discussed example of only headerless gyro data in the FIFO one "frame" would be the FIFO length reporting 6 bytes.

    Thank you for the clarification. I also found the issue with the fifo length code posted above the following was incorrect

    this->read_register(busfd,0x24,data,1);
     
    //it should be
     
    this->read_register(busfd,0x24,data,2); // to read 0x25 also
    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