Bosch Sensortec Community

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

    BMA456 Accelerometer Self-Test Feature Failing (Giving 0x07 X Y and Z axis failed)

    BMA456 Accelerometer Self-Test Feature Failing (Giving 0x07 X Y and Z axis failed)

    microfactory
    Member

    Hi,

    We are using an STM32 and downloaded drivers from the Bosch website for the BMA456 accelerometer. We are using I2C with address 0x18 for the device.

    Using the function in the API "bma4_perform_accel_selftest" returns the error code "BMA4_SELFTEST_DIFF_X_Y_AND_Z_AXIS_FAILED" when we use it, while reading from the accelerometer fifo during regular device operation gives us reasonable values indicating that things are working..

    Before calling this function, we execute the following to initialize:

    uint8_t addr = BMA4_I2C_ADDR_PRIMARY;
    dev->intf_ptr = &addr;
    dev->intf = BMA4_I2C_INTF;
    dev->bus_read = user_i2c_read;
    dev->bus_write = user_i2c_write;
    dev->delay_us = user_delay_us;
    dev->chip_id = BMA456_CHIP_ID;
    dev->variant = BMA45X_VARIANT;
    dev->resolution = BMA4_16_BIT_RESOLUTION;

    int8_t rslt;

    bma456_init(dev);

    // Then call self test like so:

    bma4_perform_accel_selftest(&rslt, dev);
    bma4_soft_reset(dev);

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

    Is there something we are doing incorrect in the procedure to run the test? We have not been able to figure out how to run a successful self test and all the connections to the device are good.

    Thanks,

    Alex P

    4 REPLIES 4

    BSTRobin
    Community Moderator
    Community Moderator

    Hello microfactory,

    Before you do selftest, it is better to do soft reset and delay 200 ms.

    /* Triggers a soft reset */
    rslt = bma4_soft_reset(dev);
    dev->delay_us(BMA4_MS_TO_US(200), dev->intf_ptr);

    Thanks for the reply, I have made the change you suggested and received the following message now when running the test:

    "BMA4_SELFTEST_FAIL or BMA4_SELFTEST_DIFF_X_AXIS_FAILED"

    I have gotten this message on multiple devices, which I suspect means there's something else I am not doing in this block...

    Occasionally the reset addition causes the program to hang..

    Code:

    uint8_t addr = BMA4_I2C_ADDR_PRIMARY;
    dev->intf_ptr = &addr;
    dev->intf = BMA4_I2C_INTF;
    dev->bus_read = user_i2c_read;
    dev->bus_write = user_i2c_write;
    dev->delay_us = user_delay_us;
    dev->chip_id = BMA456_CHIP_ID;
    dev->variant = BMA45X_VARIANT;
    dev->resolution = BMA4_16_BIT_RESOLUTION;

    int8_t rslt;
    bma456_init(dev);

    /* Triggers a soft reset */
    rslt = bma4_soft_reset(dev);
    dev->delay_us(BMA4_MS_TO_US(200), dev->intf_ptr);

    bma4_perform_accel_selftest(&rslt, dev);
    bma4_soft_reset(dev);
    buffer[2] = *((uint8_t *)&rslt);

    Hello microfactory,

    I setup SW code on MCU, BMA456 selft test works well. Please refer the code attached.

    BMA456 selft test result.png

    Thanks BSTRobin, I have added the changes and configuration procedure you provided and finally got the self-test feature to work!

    On our end, we had unfortunately incorrectly configured the delay_us function which solved the issue after going through the above configuration.

    - Microfactory Co-op

    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