Bosch Sensortec Community

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

    BMI160 significant motion problem

    BMI160 significant motion problem

    j_marijan
    Member

    Hi,

    We are having problems with significant motion interrupt triggering. It behaves really flaky.

    On some program run, interrupt behaves as it should, and sometimes, it cannot be triggered, no matter what motion you do . My opinion is that BMI isn't configured properly every time, altough  bmi160_set_int_config  function returns that is executed properly.

     

    Flow in program is: 

    • Initialize sensor through bmi160_init
    • Configure sensor with these parameters: 

     

      _bmi160_sensor.accel_cfg.odr = BMI160_ACCEL_ODR_1600HZ;
      _bmi160_sensor.accel_cfg.range = BMI160_ACCEL_RANGE_2G;
      _bmi160_sensor.accel_cfg.bw = BMI160_ACCEL_BW_NORMAL_AVG4;
    
      _bmi160_sensor.accel_cfg.power = BMI160_ACCEL_NORMAL_MODE;
    
      _bmi160_sensor.gyro_cfg.odr = BMI160_GYRO_ODR_3200HZ;
      _bmi160_sensor.gyro_cfg.range = BMI160_GYRO_RANGE_2000_DPS;
      _bmi160_sensor.gyro_cfg.bw = BMI160_GYRO_BW_NORMAL_MODE;
    
      _bmi160_sensor.gyro_cfg.power = BMI160_GYRO_NORMAL_MODE;
    • Configure sensor interrupt with these parameters: 
    interrupt_config.int_channel = BMI160_INT_CHANNEL_1;
      interrupt_config.int_type = BMI160_ACC_SIG_MOTION_INT;
      interrupt_config.int_pin_settg.output_en = BMI160_ENABLE;
      interrupt_config.int_pin_settg.output_mode = BMI160_DISABLE;
      interrupt_config.int_pin_settg.output_type = BMI160_DISABLE;
      interrupt_config.int_pin_settg.edge_ctrl = BMI160_ENABLE;
      interrupt_config.int_pin_settg.input_en = BMI160_DISABLE;
      interrupt_config.int_pin_settg.latch_dur = BMI160_LATCH_DUR_NONE;
    
      // Proof time of motion detection. 0=0.24s, 1=0.48s, 2=0.96s, 3=1.92s
      interrupt_config.int_type_cfg.acc_sig_motion_int.sig_mot_proof = sig_mot_proof;
      // Time to skip between two motion detect check. 0=1.28s, 1=2.56s, 2=5.12s,
      // 3=10.24s
      interrupt_config.int_type_cfg.acc_sig_motion_int.sig_mot_skip = sig_mot_skip;
      /* Threshold value. (2-g range) -> Threshold * 3.91 mg
      (4-g range) -> Threshold * 7.81 mg
      (8-g range) -> Threshold * 15.63 mg
      (16-g range) -> Threshold * 31.25 mg */
      interrupt_config.int_type_cfg.acc_sig_motion_int.sig_mot_thres = sig_mot_thres;
    
      int8_t result = bmi160_set_int_config(&interrupt_config, &_bmi160_sensor);
    • Reading data and interrupt data in separate thread

     

    Data from accelerometer works fine no matter what, but interrupt isn't.

    Do you have any clue what can be problem here? Do I need to change some values in configuration? Do I need to change an order of execution, so set interrupt configuration before sensor configuration?

    Looking forward for your answer.

    Best regards,

    Josip

     

     

    8 REPLIES 8

    sinya
    Member

    Hi,

    1. Are you using the API code in the Github:

    https://github.com/BoschSensortec/BMI160_driver

    2. The configuration sequence is right in your code.

    what are the value of these parameters?

    sig_mot_proof = ? sig_mot_skip = ? sig_mot_thres?

    you can firstly use the defalut register value to see the behavior.

    3.Could you observe the waveform using salea logic analyzer to see i2c/spi, interrupt pin waveform during this process? 

    4. Could you read back all the registers after configure them to check if the configuration is successfully or not?

    5. The significant motion is not easily tirggered like any motion because after motion detected, the skip time and proof time should also be fulfilled.(refer to page 27).

     

     

    Missing some words: for item 5, refer to page 25 in the BMI160 Datasheet(significant motion).

    Hi,

    I am trying to set an interruption with significant motion detector but it only works with accelerometer in normal mode. I want to use it with accelerometer in low power mode and the datasheet of the sensor specifies the current consumption for "Significant motion detector, gyro in suspend, accel in low power mode @50Hz". What parameters do I need for low power mode and significant motion interruption?

    Thanks!

    Hi,

    1. BMI160 supports significant motion  in low power mode.

    2. it does not depend on the gyroscope status.

    3. it seems you got the significant motion interrupt in acc normal mode.

    4. based on step 3:

    1)firstly write 0x12 to register 0x7e , set MSB bit acc_us of register 0x40 to 1 in order to set acc power mode to low power mode.

    2) set bit [3:0] of register 0x40 to 7 for 50hz ODR

    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