Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMA400 autowakeup and inactivity interrupts

    Highlighted
    Occasional Visitor

    BMA400 autowakeup and inactivity interrupts

    Hello,

    Introduction about BMA400 Auto Wakeup and Auto Low Power 

    By following the above guide I tried to configure BMA400 to generate two interrupts:

    • Autowakeup
    • Gen1 - inactivity

    Both of the interrupts work alone. However, when I try to enable both, only the last configured interrupt works. 

    case 1:

    • Autowakeup
    • Gen1 - inactivity ->Only this works

    case 2:

    • Gen1 - inactivity 
    • Autowakeup -> Only this works

     

    Here is the code:

     

    #define NUMBER_OF_DEVICE_CONFIG 2
    uint8_t power_mode;
    struct bma400_device_conf conf[NUMBER_OF_DEVICE_CONFIG];
    /* Interrupt configuration structure */
    struct bma400_int_enable int_en;
    
    /* Selecting auto wakeup on wakeup interrupt event */
    conf[0].type = BMA400_AUTOWAKEUP_INT;
    /* Selecting auto low power mode*/
    conf[1].type = BMA400_AUTO_LOW_POWER;
    
    /* Get the previously set settings */
    _rslt = bma400_get_device_conf(conf, NUMBER_OF_DEVICE_CONFIG, &_bma);
    print_rslt(_rslt);
    
    conf[0].param.wakeup.wakeup_ref_update = BMA400_EVERY_TIME_UPDATE;
    conf[0].param.wakeup.sample_count = BMA400_SAMPLE_COUNT_2;
    conf[0].param.wakeup.wakeup_axes_en = BMA400_XYZ_AXIS_EN;
    conf[0].param.wakeup.int_wkup_threshold = 3;
    conf[0].param.wakeup.int_chan = BMA400_INT_CHANNEL_1;
    
    /* Enable auto low power on Gen1 trigger */
    conf[1].param.auto_lp.auto_low_power_trigger = BMA400_AUTO_LP_GEN1_TRIGGER;
    
    /* Set the configurations in sensor */
    _rslt = bma400_set_device_conf(conf, NUMBER_OF_DEVICE_CONFIG, &_bma);
    print_rslt(_rslt);
    
    #define NUMBER_OF_SENSOR_CONFIG 2
    struct bma400_sensor_conf conf[NUMBER_OF_SENSOR_CONFIG];
    
    /* Select the type of configuration to be modified */
    conf[0].type = BMA400_ACCEL;
    conf[1].type = BMA400_GEN1_INT;
    
    /* Get the accelerometer configurations which are set in the sensor */
    _rslt = bma400_get_sensor_conf(conf, NUMBER_OF_SENSOR_CONFIG, &_bma);
    print_rslt(_rslt);
    
    /* Modify the desired configurations as per macros
    * available in bma400_defs.h file */
    // conf[0].param.accel.odr = BMA400_ODR_100HZ;
    conf[0].param.accel.range = BMA400_4G_RANGE;
    conf[0].param.accel.data_src=BMA400_DATA_SRC_ACCEL_FILT_1;
    conf[0].param.accel.filt1_bw = BMA400_ACCEL_FILT1_BW_1;
    
    // inactivity
    conf[1].param.gen_int.gen_int_thres = 3; // x 8mg
    conf[1].param.gen_int.gen_int_dur = 100; // x ODR
    conf[1].param.gen_int.axes_sel = BMA400_XYZ_AXIS_EN;
    conf[1].param.gen_int.data_src=BMA400_DATA_SRC_ACC_FILT2;
    conf[1].param.gen_int.criterion_sel = BMA400_INACTIVITY_INT;
    conf[1].param.gen_int.evaluate_axes = BMA400_ALL_AXES_INT;
    conf[1].param.gen_int.ref_update = BMA400_EVERY_TIME_UPDATE;
    conf[1].param.gen_int.hysteresis = BMA400_HYST_0_MG;
    conf[1].param.gen_int.int_chan = BMA400_INT_CHANNEL_2;
    
    /* Set the desired configurations to the sensor */
    _rslt = bma400_set_sensor_conf(conf, NUMBER_OF_SENSOR_CONFIG, &_bma);
    print_rslt(_rslt);
    
    #define NUMBER_OF_INTERRUPT 2
    struct bma400_int_enable int_select[NUMBER_OF_INTERRUPT];
    
    int_select[0].type = BMA400_GEN1_INT_EN;
    int_select[0].conf = BMA400_ENABLE;
    
    int_select[1].type = BMA400_AUTO_WAKEUP_EN;
    int_select[1].conf = BMA400_ENABLE;
    
    _rslt = bma400_enable_interrupt(int_select, NUMBER_OF_INTERRUPT, &_bma);
    print_rslt(_rslt);
    
    _rslt = bma400_set_power_mode(BMA400_LOW_POWER_MODE, &_bma);
    print_rslt(_rslt);

     

     
    Thanks,
    Mehmet
    1 REPLY 1
    Highlighted
    Community Moderator

    Re: BMA400 autowakeup and inactivity interrupts

    Hi,

    Thanks for your inquiry. Please see the attached "How to test BMA400 shuttle board for auto-wakeup and auto-lowpower featurev1.pdf" for more informaiton.

    Thanks.

    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