Bosch Sensortec Community

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

    BMX160 how to correct initize for get Accel and Gyro ?

    BMX160 how to correct initize for get Accel and Gyro ?

    Cyberwiz
    New Poster

    Hi

    I'm using the bmx160 sensor for a project, I can get device ID "0xD8" and write value to register via I2C, but cannot get correct Accel and gyro raw data.

    Ex. Get Accel Raw 10 data as bellow by combine LSB with HSB

    accel_raw_x = (int16_t)(((uint16_t)xyz_data[15] << 😎 | xyz_data[14]);
    accel_raw_y = (int16_t)(((uint16_t)xyz_data[17] << 😎 | xyz_data[16]);
    accel_raw_z = (int16_t)(((uint16_t)xyz_data[19] << 😎 | xyz_data[18]);

    X: Y: Z-- [ -4608 : 6655 : 5635 ]
    X: Y: Z-- [ -9472 : -769 : 18178 ]
    X: Y: Z-- [ -4608 : -4353 : 22018 ]
    X: Y: Z-- [ -8448 : 3071 : 12803 ]
    X: Y: Z-- [ 0 : 512 : 18947 ]
    X: Y: Z-- [ -4608 : -1025 : 16386 ]
    X: Y: Z-- [ -6912 : -5633 : 6914 ]
    X: Y: Z-- [ -12544 : -6401 : 2050 ]
    X: Y: Z-- [ -6656 : 1535 : 9731 ]
    X: Y: Z-- [ -7424 : -1793 : 514 ]
    X: Y: Z-- [ -6656 : -513 : 4610 ] 

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

    Here is my description for how to initialize BMX160 and get Accel and gyro raw data

    [Step1]:  write 0xb6 to 0x7E for softreset

    [Step2]: write 0x11 and 0x15 to 0x7E for Accel and Gyro power normal mode and delay 100ms for each

    [Step3]: Read 0x12 to 0x17 and 0x0C to 0x11 for Accel and Gyro

     

    Accel Raw data should be like x=-526, y=254, z=16424, not my raw data have not max z data.

    Could you help me figure out what initialization or steps I'm missing?

     

    Thanks for your time

    2 REPLIES 2

    BSTRobin
    Community Moderator
    Community Moderator

    Hi Cyberwiz,

    We upload BMX160 example code on STM32 for your reference, hope it will be helpful for you.

    Hi BSTRobin

    According to the example code, seems we only need to set these two command to initialize BMX160 for get Accel data,
    is that correct ?

    BMI160_SOFT_RESET_CMD
    BMI160_ACCEL_NORMAL_MODE


    int8_t Init_BMI160(struct bmi160_dev *dev)
    {
    rslt = bmi160_soft_reset(dev);-->BMI160_SOFT_RESET_CMD
    dev->delay_ms(200);
    .
    .

    rslt = bmi160_init(dev); -->bmi160_soft_reset(dev);
    .
    .
    /* Set the Power mode */
    rslt = bmi160_set_power_mode(dev);-->BMI160_ACCEL_NORMAL_MODE

     

     

     

    B.R.

    Abner

     

     

    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