Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMI160 Driver - Can't configure FIFO to be headerless

    BMI160 Driver - Can't configure FIFO to be headerless

    dtang
    New Poster

    Hi There:

      I'm working with the driver from Github, trying to capture just Accelerometer data from the FIFO in headerless mode, and I've noticed that in the current driver code it's not possible to place the BMI160 into headerless mode.  Thee problem is in bmi160_set_fifo_config() on line 2248: data |= fifo_config;

     

           rslt = bmi160_get_regs(reg_addr, &data, BMI160_ONE, dev);
            if (rslt == BMI160_OK)
            {
                if (fifo_config > 0)
                {
                    if (enable == BMI160_ENABLE)
                    {
                        data = data | fifo_config; //Problem is on this line
                    }
                    else
                    {
                        data = data & (~fifo_config);
                    }
                }
    
                /* write fifo frame content configuration*/
                rslt = bmi160_set_regs(reg_addr, &data, BMI160_ONE, dev);

     


    As shown in the code above, the configuration that gets sent to the BMI FIFO register is an OR of the current configuration and the incoming fifo_config requested.  Since Headerless mode is achieved by clearing a bit that is set by default, we can never actually clear this bit.  My proposed woraround is to always use the unaltered incoming config without the logical OR of the previously set state:

    data = fifo_config;

    This will require to user to set the expected configuration on every FIFO config change, but I don't think that's too much to ask.

    thanks

    Dan

    5 REPLIES 5

    BSTRobin
    Community Moderator
    Community Moderator

    Hello dtang,

    Before FIFO configuring FIFO, you could clear FIFO coonfiguration register with following code.

    /* Clear FIFO configuration register */
    rslt = bmi160_set_fifo_config(BMI160_FIFO_CONFIG_1_MASK, BMI160_DISABLE, dev);

    Thanks for this approach

     

    Is this documented somewhere that I missed?

    BSTRobin
    Community Moderator
    Community Moderator

    Hello dtang,

    This part of the code is to clear the register value, refer to the register bit of the data sheet.

    I understand how to clear the register bit, I'm just not certain if the solution you provided is a workaround to a bug, or is the proper, documented approach.  I need to be able to comment my code accordingly.  thanks!

    Dan

    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