Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMI 160 Reading Single Tap Issue

    BMI 160 Reading Single Tap Issue

    akarabacak
    New Poster

    Hi, I have an issue to read single tap from BMI 160.

    // Power configurations.

    sensor.accel_cfg.odr = BMI160_ACCEL_ODR_1600HZ;
    sensor.accel_cfg.range = BMI160_ACCEL_RANGE_2G;
    sensor.accel_cfg.bw = BMI160_ACCEL_BW_NORMAL_AVG4;
    sensor.accel_cfg.power = BMI160_ACCEL_LOWPOWER_MODE;

    sensor.gyro_cfg.odr = BMI160_GYRO_ODR_3200HZ;
    sensor.gyro_cfg.range = BMI160_GYRO_RANGE_2000_DPS;
    sensor.gyro_cfg.bw = BMI160_GYRO_BW_NORMAL_MODE;
    sensor.gyro_cfg.power = BMI160_GYRO_NORMAL_MODE;

    rslt = bmi160_set_sens_conf(&sensor);

    // Interrupt Configurations

    int_config.int_channel = BMI160_INT_CHANNEL_1;// Interrupt channel/pin 1
    /* Select the Interrupt type */
    int_config.int_type = BMI160_ACC_SINGLE_TAP_INT;// Choosing Single Tap 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_DISABLE;// Choosing active low 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 Single tap interrupt parameters */
    int_config.int_type_cfg.acc_tap_int.tap_thr = 1;
    int_config.int_type_cfg.acc_tap_int.tap_shock = BMI160_ENABLE;
    int_config.int_type_cfg.acc_tap_int.tap_quiet = BMI160_ENABLE;
    int_config.int_type_cfg.acc_tap_int.tap_dur = 1;
    int_config.int_type_cfg.acc_tap_int.tap_data_src=BMI160_ENABLE;
    int_config.int_type_cfg.acc_tap_int.tap_en = BMI160_ENABLE;

    /* Set the Single Tap interrupt */
    bmi160_set_int_config(&int_config, &sensor); /* sensor is an instance of the structure bmi160_dev */

    // And the reading part

    int_status_sel = BMI160_INT_STATUS_ALL;
    rslt = bmi160_get_int_status(int_status_sel, &interrupt, &sensor);
    if (interrupt.bit.s_tap)
    {
    int a = 0;
    }
    else
    {
    int b = 0;
    }
    }

    3 REPLIES 3

    Vincent
    Community Moderator
    Community Moderator

    Can you check register 0x02 first then the accel data from data register if there is correct accel data inside? 

    I think your accel setting has some problem so your accel is not working properly. 

    This is the root cause why you didn't see tap interrupt. 

    In datasheet, table 8 (page 15 - 16), you can find that 1600Hz is only valid for normal power mode not low power mode. 

    • I check the register and I read 0x00
    • And also change the ODR frequency and again nothing has changed.

    Vincent
    Community Moderator
    Community Moderator

    Can you also read out the Accel sensor data? 

    In your code,  i didn't see you to change the power mode of accel by write command register (0x7E) with value 0x11. 

    Then please try to use LATCH mode for the interrupt to make sure you are not missing the interrupt if your host is not fast enough to react to the 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