Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMI160 Sensor INT not Stable

    BMI160 Sensor INT not Stable

    SanskarBiswal
    Member

    I am using the BMI160 in the following configuration. I have High G and FLAT Interrupt on INT2. I want to send the FLAT interrupt status when HIGH-G is triggered. However, the FLAT INT value is 1 only when the module is kept idle and on a table. If I do any high-g motion on it, the FLAT interrupt becomes 0 despite keeping the device flat.
    I have code snippets below which I have used.

     

    FLAT INT

    int8_t rslt;
    struct bmi160_int_settg int1;
    int1.int_channel = BMI160_INT_CHANNEL_2;
    int1.int_type = BMI160_ACC_FLAT_INT;
    int1.int_pin_settg.output_en = BMI160_ENABLE;
    int1.int_pin_settg.output_mode = BMI160_DISABLE;
    int1.int_pin_settg.output_type = BMI160_DISABLE;
    int1.int_pin_settg.edge_ctrl = BMI160_DISABLE;
    int1.int_pin_settg.input_en = BMI160_DISABLE;
    int1.int_pin_settg.latch_dur = BMI160_LATCH_DUR_NONE;

    int1.int_type_cfg.acc_flat_int.flat_en = 1;
    int1.int_type_cfg.acc_flat_int.flat_theta = 40;
    int1.int_type_cfg.acc_flat_int.flat_hy = 2;
    int1.int_type_cfg.acc_flat_int.flat_hold_time = 0;

    rslt = bmi160_set_int_config(&int1, &bmi160);

     

    HIGH G Conf.

    int2.int_channel = BMI160_INT_CHANNEL_2;
    int2.int_type = BMI160_ACC_HIGH_G_INT;
    int2.int_pin_settg.output_en = BMI160_ENABLE;
    int2.int_pin_settg.output_mode = BMI160_DISABLE;
    int2.int_pin_settg.output_type = BMI160_DISABLE;
    int2.int_pin_settg.edge_ctrl = BMI160_DISABLE;
    int2.int_pin_settg.input_en = BMI160_DISABLE;
    int2.int_pin_settg.latch_dur = BMI160_LATCH_DUR_NONE;


    int2.int_type_cfg.acc_high_g_int.high_g_x = 1;
    int2.int_type_cfg.acc_high_g_int.high_g_y = 0;
    int2.int_type_cfg.acc_high_g_int.high_g_z = 0;
    int2.int_type_cfg.acc_high_g_int.high_hy = 2;
    int2.int_type_cfg.acc_high_g_int.high_data_src=0;
    int2.int_type_cfg.acc_high_g_int.high_dur = 2;
    int2.int_type_cfg.acc_high_g_int.high_thres = 10;

     

    Orientation Config

    // Orientation
    int1.int_channel = BMI160_INT_CHANNEL_2;
    int1.int_type = BMI160_ACC_ORIENT_INT;
    int1.int_pin_settg.output_en = BMI160_ENABLE;
    int1.int_pin_settg.output_mode = BMI160_DISABLE;
    int1.int_pin_settg.output_type = BMI160_DISABLE;
    int1.int_pin_settg.edge_ctrl = BMI160_DISABLE;
    int1.int_pin_settg.input_en = BMI160_DISABLE;
    int1.int_pin_settg.latch_dur = BMI160_LATCH_DUR_NONE;

    int1.int_type_cfg.acc_orient_int.orient_en = 1;
    int1.int_type_cfg.acc_orient_int.orient_mode = 1;
    int1.int_type_cfg.acc_orient_int.orient_theta = 10;
    int1.int_type_cfg.acc_orient_int.orient_ud_en = 1;
    int1.int_type_cfg.acc_orient_int.orient_hyst = 1;
    int1.int_type_cfg.acc_orient_int.axes_ex = 0;
    //int2.int_type_cfg.acc_orient_int.
    int1.int_type_cfg.acc_orient_int.orient_blocking = 3;
    rslt = bmi160_set_int_config(&int1, &bmi160);

    Interrupt Handler

    if(pin == BMI160_INT2)
    {
    //imu_flat = flat;
    bool orient = true;
    if (high) {
    if (!high_g && in_hand)
    {
    high_g = true;
    bool orient = false;
    uint16_t len = 30;
    raw_data_buffer[8] = 0x1A;
    raw_data_buffer[10] = 0x1F; // Start Activity ID
    raw_data_buffer[12] = tool_id; // Tool ID
    raw_data_buffer[14] = imu_flat; // Starting Orientation
    activity_counter = 1;
    ble_nus_data_send(&m_nus, raw_data_buffer, &len, m_conn_handle);
    }else {
    activity_counter++;
    }
    }
    if (flat)
    {
    orient = false;
    //imu_flat = int_status.bit.flat;
    imu_flat = 1;
    }
    if (orient){
    imu_flat = 0;
    }
    }

     

    Any solution?

    4 REPLIES 4

    BSTRobin
    Community Moderator
    Community Moderator

    Hi SanskarBiswal,

    For your description "If I do any high-g motion on it, the FLAT interrupt becomes 0 despite keeping the device flat.", do you mean you move the sensor horizontally and meet the condition of high-G?
    You could give detailed description about your test.

    I hold the sensor flat, and move it in the horizontal plane. Since, it is still flat, I should get the High-G but the flat interrupt triggeres and changes to 0, (non-flat), which is obviously incorrect.

     

    Also, when the imu is held flat, the orientation interrupt gets triggered as well. This means I cannot tell for sure if the device has actually gone into the non-idle position.

    Hi SanskarBiswal,

    High-g only detects the z-axis acceleration value.

    We would like to confirm with you which of the following situations you expect?
    1. If flat and high-g are enabled at the same time, High-g will affect the detection of flat, right?
    2. Don't turn on high g, just turn on flat. You expect flat interrupt output when IMU is flat and Z axis has acceleration, right?

    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