Important Cookie Information

This website uses absolutely necessary cookies. If you consent to the use of convenience cookies, please click “Yes, I agree.” By clicking on “Privacy Settings.” you can change this setting at any time and withdraw your given consent. Icon down see more You can find detailled information in our Privacy Policy Icon forward-right
Icon up see less

Bosch Sensortec Community

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

    BMI160 Significant Motion Interrupt with FIFO

    New Poster

    BMI160 Significant Motion Interrupt with FIFO

    I'm trying to understand how to configure the BMI160 so that I can read the FIFO when a significant motion interrupt occurs.  Here is how I have the BM160 configured at the moment. After the initial setup I'm not sure how to go about configuring the FIFO so that it has accelerometer data.

    Also, I setup both interrupt pins since they are connected to an OR gate on my hardware and I need both of them to set to active high.  

    Note: I'm using this API https://github.com/BoschSensortec/BMI160_driver

    /* Select the Output data rate, range of accelerometer sensor */
    dev->accel_cfg.odr = BMI160_ACCEL_ODR_100HZ;
    dev->accel_cfg.bw = BMI160_ACCEL_BW_NORMAL_AVG4;

    /* Select the power mode of accelerometer sensor */
    dev->accel_cfg.power = BMI160_ACCEL_NORMAL_MODE;

    /* Select the Output data rate, range of Gyroscope sensor */
    dev->gyro_cfg.odr = BMI160_GYRO_ODR_100HZ;
    dev->gyro_cfg.range = BMI160_GYRO_RANGE_2000_DPS;
    dev->gyro_cfg.bw = BMI160_GYRO_BW_NORMAL_MODE;

    /* Select the power mode of Gyroscope sensor */
    dev->gyro_cfg.power = BMI160_GYRO_SUSPEND_MODE;

    int8_t result = bmi160_set_sens_conf(dev);

    struct bmi160_int_settg int_config;

    int_config.int_channel = BMI160_INT_CHANNEL_1; // Interrupt channel/pin 1

    /* Select the Interrupt type */
    int_config.int_type = BMI160_ACC_ANY_MOTION_INT; // Choosing Any motion interrupt

    /* Select the interrupt channel/pin settings */
    int_config.int_pin_settg.output_en = BMI160_ENABLE; // Enabling interrupt pins to act as output pin
    int_config.int_pin_settg.output_mode = BMI160_DISABLE; // Choosing push-pull mode for interrupt pin
    int_config.int_pin_settg.output_type = BMI160_ENABLE; // Choosing active high output
    int_config.int_pin_settg.edge_ctrl = BMI160_ENABLE; // Choosing edge triggered output
    int_config.int_pin_settg.input_en = BMI160_DISABLE; // Disabling interrupt pin to act as input
    int_config.int_pin_settg.latch_dur = BMI160_LATCH_DUR_NONE; // non-latched output

    /* Select the Any-motion interrupt parameters */
    int_config.int_type_cfg.acc_any_motion_int.anymotion_en = BMI160_DISABLE; // 1- Enable the any-motion, 0- disable any-motion
    int_config.int_type_cfg.acc_any_motion_int.anymotion_x = BMI160_ENABLE; // Enabling x-axis for any motion interrupt
    int_config.int_type_cfg.acc_any_motion_int.anymotion_y = BMI160_ENABLE; // Enabling y-axis for any motion interrupt

    int_config.int_type_cfg.acc_any_motion_int.anymotion_z = BMI160_ENABLE; // Enabling z-axis for any motion interrupt

    int_config.int_type_cfg.acc_any_motion_int.anymotion_dur = 0; // any-motion duration
    int_config.int_type_cfg.acc_any_motion_int.anymotion_thr = 20;

    result
    = bmi160_set_int_config(&int_config, dev);

    /* Select the Interrupt channel/pin */

    int_config.int_channel = BMI160_INT_CHANNEL_2; // Interrupt channel/pin 2

    /* Select the Interrupt type */
    int_config.int_type = BMI160_ACC_SIG_MOTION_INT; // Choosing Significant motion interrupt

    /* Select the interrupt channel/pin settings */
    int_config.int_pin_settg.output_en = BMI160_ENABLE; // Enabling interrupt pins to act as output pin
    int_config.int_pin_settg.output_mode = BMI160_DISABLE; // Choosing push-pull mode for interrupt pin
    int_config.int_pin_settg.output_type = BMI160_ENABLE; // Choosing active high output
    int_config.int_pin_settg.edge_ctrl = BMI160_ENABLE; // Choosing edge triggered output
    int_config.int_pin_settg.input_en = BMI160_DISABLE; // Disabling interrupt pin to act as
    int_config.int_pin_settg.latch_dur = BMI160_LATCH_DUR_NONE; // non-latched output

    int_config.int_type_cfg.acc_sig_motion_int.sig_en = BMI160_ENABLE;
    int_config.int_type_cfg.acc_sig_motion_int.sig_data_src = BMI160_DISABLE;
    int_config.int_type_cfg.acc_sig_motion_int.sig_mot_proof = 0x3;
    int_config.int_type_cfg.acc_sig_motion_int.sig_mot_skip = 0x0;

    int_config.int_type_cfg.acc_sig_motion_int.sig_mot_thres = 0x14;
    result = bmi160_set_int_config(&int_config, dev);
    Tags (3)
    1 REPLY 1
    Highlighted
    Community Moderator
    Community Moderator

    Re: BMI160 Significant Motion Interrupt with FIFO

    int_config.int_type_cfg.acc_any_motion_int.anymotion_en = BMI160_DISABLE; // 1- Enable the any-motion, 0- disable any-motion

    In your code you disable the any-motion interrupt mapping to the pin. I believe this is an error.

     

    The rest looks good.

    INT1 : Any-motion

    INT2: Significant Motion

     

    What you most likely want is to enable the Accelerometer data in the FIFO in STREAM mode, so upon overflow, the oldest data is overwritten. When you get an interrupt, you can then read the most recent last 1kB of accelerometer data.

     

    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