Bosch Sensortec Community

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

    BMA423 any motion interrupt not firing

    BMA423 any motion interrupt not firing

    LHeeren
    Member

    Hello! I'm currently working with a BMA423 (accelerometer) and I'm trying to get the interrupt working for the any motion configuration. I'm using the API from your github page and can read out the temperature or xyz values for example. I used the motion example as an example and read the post on the bosch community website to further enhance it. This is the code I'm using:

    ---------------------

    m_rslt = bma4_interface_selection(&m_bma, BMA42X_VARIANT, i2c);

    /* Sensor initialization */
    m_rslt = bma423_init(&m_bma);

    /* Upload the configuration file to enable the features of the sensor. */
    m_rslt = bma423_write_config_file(&m_bma);

    /* Enable the accelerometer */
    m_rslt = bma4_set_accel_enable(BMA4_ENABLE, &m_bma);

    /* Accelerometer Configuration Setting */
    /* Output data Rate */
    m_accel_conf.odr = BMA4_OUTPUT_DATA_RATE_100HZ;

    /* Gravity range of the sensor (+/- 2G, 4G, 8G, 16G) */
    m_accel_conf.range = BMA4_ACCEL_RANGE_16G;

    /* Bandwidth configure number of sensor samples required to average
    * if value = 2, then 4 samples are averaged
    * averaged samples = 2^(val(accel bandwidth))
    * Note1 : More info refer datasheets
    * Note2 : A higher number of averaged samples will result in a lower noise level of the signal, but
    * since the performance power mode phase is increased, the power consumption will also rise.
    */
    m_accel_conf.bandwidth = BMA4_ACCEL_NORMAL_AVG4;

    /* Enable the filter performance mode where averaging of samples
    * will be done based on above set bandwidth and ODR.
    * There are two modes
    * 0 -> Averaging samples (Default)
    * 1 -> No averaging
    * For more info on No Averaging mode refer datasheets.
    */
    m_accel_conf.perf_mode = BMA4_CONTINUOUS_MODE;//BMA4_CIC_AVG_MODE;

    /* Set the accel configurations */
    m_rslt = bma4_set_accel_config(&m_accel_conf, &m_bma);

    /* Select the axis for which any/no motion interrupt should be generated */
    m_any_no_mot.axes_en = BMA423_EN_ALL_AXIS;

    /*
    * Set the slope threshold:
    * Interrupt will be generated if the slope of all the axis exceeds the threshold (1 bit = 0.48mG)
    */
    m_any_no_mot.threshold = 1; <- I tried several options ranging from 1 to 10

    /*
    * Set the duration for any/no motion interrupt:
    * Duration defines the number of consecutive data points for which threshold condition must be true(1 bit = 20ms)
    */
    m_any_no_mot.duration = 1; <- I tried several options ranging from 1 to 4

    /* Set the threshold, duration and axis enable configuration */
    m_rslt = bma423_set_any_mot_config(&m_any_no_mot, &m_bma);

    /* Map the interrupt pin with that of any-motion and no-motion interrupts.
    * Interrupt will be generated when any or no-motion is recognized.
    * BMA423_ANY_MOT_INT seems to be defined incorrectly according to the datasheet. I tried BMA423_ANY_MOT_INT (0x20), but that did not work.
    * 0x40 sets the seventh bit on 1, which seems to be the correct value according to the datasheet. I also tried 0xFF to set it al to 1 and tried 0x00 to set it all to 0.
    */
    m_rslt = bma423_map_interrupt(BMA4_INTR1_MAP, 0x40, BMA4_ENABLE, &m_bma);

    m_int_config.edge_ctrl = BMA4_LEVEL_TRIGGER;
    m_int_config.lvl = BMA4_ACTIVE_HIGH;
    m_int_config.od = BMA4_PUSH_PULL;
    m_int_config.output_en = BMA4_OUTPUT_ENABLE;
    m_int_config.input_en = BMA4_INPUT_DISABLE;
    m_rslt = bma4_set_int_pin_config(&m_int_config, BMA4_INTR1_MAP, &m_bma);

    m_rslt = bma4_set_interrupt_mode(BMA4_LATCH_MODE, &m_bma);

    # in a process function:

    bma4_read_accel_xyz(&m_sens_data, &m_bma); <- works!

    bma4_get_temperature(&temperature, BMA4_DEG, &m_bma); <- works!

    m_rslt = bma423_read_int_status(&m_int_status, &m_bma); <- does not work. m_rslt is always 0x00 and m_int_status is also always 0x00. I'm shaking it quite heavily and for several seconds.

    --------------------

    I hope someone can help out! Thanks in advance.

    7 REPLIES 7

    Minhwan
    Community Moderator
    Community Moderator

    Hello LHeeren, 

     

    It looks okay, but it might be some issue. 

    To remove hardware issue, I strongly recommend to test with our board first, then you are sure that your software is okay. 

    Please check our app 2.0 and BMA423 shuttle board 

    https://www.digikey.com/en/products/detail/bosch-sensortec/SHUTTLE-BOARD-BMA423/7401314https://www.b...

    https://www.digikey.com/en/products/detail/bosch-sensortec/0330-AB0-011/2416312

    Thanks, 

     

    Hi! I wanted to order the parts, but I see that  the 2.0 board is not in production anymore. Is there another board that I could use? Would the 3.0 board work?

    Minhwan
    Community Moderator
    Community Moderator

    Hi LHeeren, 

     

    Sorry for late reply. 

    Unfortuantely, we don't provide BMA423 shuttle board for App3.0 

    I will close this ticket, and please create another loop if you have any issue for our devices. 

    Thank you. 

     

     

    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