Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Optimizing power consumption of BMI270 AnyMotion function

    Optimizing power consumption of BMI270 AnyMotion function

    Neo
    New Poster

    Hi,

    I use the sample code in Github to enable BMI270 anymotion function. After I enable this feature, it takes around 0.6mA @ 3V.

    I try to change anymotion parameters to reduce power consumption but I cannot obtain good results.

    Below is my source code:

    static int8_t set_feature_config(struct bmi2_dev *bmi2_dev)
    {

    /* Status of api are returned to this variable. */
    int8_t rslt;

    /* Structure to define the type of sensor and its configurations. */
    struct bmi2_sens_config config;

    /* Configure the anyMotion feature. */
    config.type = BMI2_ANY_MOTION;
    config.cfg.acc.filter_perf = BMI2_POWER_OPT_MODE;

    /* Get default configurations for the type of feature selected. */
    rslt = bmi270_get_sensor_config(&config, 1, bmi2_dev);
    print_rslt(rslt);
    if (rslt == BMI2_OK)
    {
    /* NOTE: The user can change the following configuration parameters according to their requirement. */
    /* 1LSB equals 20ms. Default is 100ms, */
    config.cfg.any_motion.duration = 0x05;

    /* 1LSB equals to 0.48mg. Default is 83mg, */
    config.cfg.any_motion.threshold = 0xAA;

    /* Set new configurations. */
    rslt = bmi270_set_sensor_config(&config, 1, bmi2_dev);

    /* Interrupt PINs configuration */
    struct bmi2_int_pin_config int_cfg;
    int_cfg.pin_type = BMI2_INT1;
    int_cfg.int_latch = BMI2_INT_NON_LATCH;
    int_cfg.pin_cfg[0].output_en = BMI2_INT_OUTPUT_ENABLE;
    int_cfg.pin_cfg[0].od = BMI2_INT_PUSH_PULL;
    int_cfg.pin_cfg[0].lvl = BMI2_INT_ACTIVE_HIGH;
    int_cfg.pin_cfg[0].input_en = BMI2_INT_INPUT_DISABLE;

    rslt = bmi2_set_int_pin_config(&int_cfg, bmi2_dev);
    print_rslt(rslt);
    }

    return rslt;
    }

    void M_DRV_BMI270_AnyMotion_Init(void)
    {
    M_PRINTF("[%s]\r\n", __func__);

    bmi_dev.read = bmi_reg_read;
    bmi_dev.write = bmi_reg_write;
    bmi_dev.delay_us = bmi_delay_us;
    bmi_dev.read_write_len = 64;
    bmi_dev.intf = BMI2_SPI_INTF;
    bmi_dev.chip_id = 1;
    bmi_dev.dummy_byte = 1;
    int8_t rslt;

    /* Accel sensor and any-motion feature are listed in array. */
    uint8_t sens_list[2] = { BMI2_ACCEL, BMI2_ANY_MOTION };

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

    /* Interface reference is given as a parameter
    * For I2C : BMI2_I2C_INTF
    * For SPI : BMI2_SPI_INTF
    */

    rslt = bmi270_init(&bmi_dev);
    print_rslt(rslt);

    if (rslt == BMI2_OK){
    /* Enable the selected sensors. */
    rslt = bmi270_sensor_enable(sens_list, 2, &bmi_dev);
    print_rslt(rslt);

    if (rslt == BMI2_OK)
    {
    /* Set feature configurations for any-motion. */
    rslt = set_feature_config(&bmi_dev);
    print_rslt(rslt);
    if (rslt == BMI2_OK)
    {
    /* Map the feature interrupt for any-motion. */
    rslt = bmi270_map_feat_int(&sens_int, 1, &bmi_dev);
    print_rslt(rslt);

    }
    }
    }
    }

    1 REPLY 1

    BSTRobin
    Community Moderator
    Community Moderator

    Hello Neo,

    Please refer the following BMI270 power modes table to set your power mode.

    BMI270 power mode.png

    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