Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMI270 raise an INT at startup

    BMI270 raise an INT at startup

    dmrsim
    New Poster

    Hello,

    I'm using a BMI270 in my project.
    I have to detect any movement using INT1 pin.

    I'm using this code to init the BMI270:

    imu2.chip_addr = BMI2_I2C_PRIM_ADDR;
    imu2.intf = BMI2_I2C_INTF;
    imu2.read = i2c_read_bytes;
    imu2.write = i2c_write_bytes;
    imu2.read_write_len = 128;

    // Initialize BMI270
    if(bmi270_legacy_init(&imu2) == BMI2_OK) {
    // CONFIGURE ACCELEROMETER SENSOR !! Need to do it before Sensor Enable!
    uint8_t sensor_list[2] = { BMI2_ACCEL, MOTION_TYPE };
    struct bmi2_sens_config config;
    config.type = BMI2_ACCEL;
    config.cfg.acc.odr = BMI2_ACC_ODR_100HZ;
    config.cfg.acc.bwp = BMI2_ACC_NORMAL_AVG4;
    config.cfg.acc.filter_perf = BMI2_PERF_OPT_MODE;
    config.cfg.acc.range = BMI2_ACC_RANGE_2G;
    bmi270_legacy_set_sensor_config(&config, 1, &imu2);
    bmi270_legacy_sensor_enable(sensor_list, 2, &imu2);

    motdet_setConfiguration(nvmInfo.motConfInfo, false); // No need to runtime apply conf here, will be done in motdet_init
    motdet_init(imu2);
    motdet_enable();
    }

    The problem is that BMI270 raise alwais an INT during the startup, and the put the INT pin down(I also analyzed it with an oscilloscope).

    Why BMI270 raise and INT during the startup?

    Thanks a lot!

    2 REPLIES 2

    dmrsim
    New Poster

    Hello, any news?? I'm in throuble...Thanks

    BSTRobin
    Community Moderator
    Community Moderator

    Hi dmrsim,

    The default interrupt triggering method is falling edge triggering, see it from the default register value:

    2023-05-24_17h37_26.png

    You can configure the interrupt triggering method you would like to use with the following reference code.

     

    #if defined(ANY_MOTION)
    int8_t Open_BMI270_ANY_MOTION(struct bmi2_dev *dev)
    {
    int8_t rslt = BMI2_OK;
    uint8_t sensor_list = BMI2_ANY_MOTION;
    /* Sensor configuration structure */
    struct bmi2_sens_config config = { 0 };

    struct bmi2_int_pin_config int_cfg;

    /* Select features and their pins to be mapped to */
    struct bmi2_sens_int_config sens_int;
    sens_int.type = BMI2_ANY_MOTION;
    sens_int.hw_int_pin = BMI2_INT1;

    /* Enable the selected sensors */
    rslt = bmi270_sensor_enable(&sensor_list, 1, dev);
    bmi2_error_codes_print_result(rslt);

    config.type = sensor_list;
    #if 1
    /* Get the previous or default configuration settings */
    rslt = bmi270_get_sensor_config(&config, 1, dev);
    if (rslt == BMI2_OK)
    {
    /* NOTE: The user can change the following configuration parameters according to their requirement. */
    /* 1LSB equals 20ms. Default is 100ms, setting to 140ms. */
    config.cfg.any_motion.duration = 7;

    /* 1LSB equals to 0.48mg. Default is 83mg, setting to 96mg. */
    config.cfg.any_motion.threshold = 200;

    /* Set the configurations */
    rslt = bmi270_set_sensor_config(&config, 1, dev);
    if (rslt != BMI2_OK)
    {
    PDEBUG("Any motion configuration failed\r\n");
    }
    else
    {
    PDEBUG("Any motion configuration set successfully\r\n");

    /* Get the configuration settings for validation */
    rslt = bmi270_get_sensor_config(&config, 1, dev);
    if (rslt == BMI2_OK)
    {
    PDEBUG("Get any motion Configuration successful\r\n");
    }
    }
    }
    #endif

    bmi2_get_int_pin_config(&int_cfg, dev);

    int_cfg.pin_type = BMI2_INT1;
    int_cfg.pin_cfg[0].lvl = BMI2_INT_ACTIVE_HIGH;/*Config INT1 rising edge trigging*/
    int_cfg.pin_cfg[0].od = BMI2_INT_PUSH_PULL;
    int_cfg.pin_cfg[0].output_en= BMI2_INT_OUTPUT_ENABLE;

    bmi2_set_int_pin_config(&int_cfg, dev);
    bmi2_error_codes_print_result(rslt);

    /* Map the feature interrupt */
    rslt = bmi270_map_feat_int(&sens_int, 1, dev);
    bmi2_error_codes_print_result(rslt);

    return rslt;
    }

    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