Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMI160 Sensor data conversion

    FAE_CA1
    Community Moderator

    Re: BMI160 Sensor data conversion

    Hi,

    Here is what you can do to verify your code.

    In your initialization function, you can configure BMI160 as below.

    Write value of 0x11 to register 0x7E;     // set ACC to normal mode, by default ACC is +/-2g full scale range and 100Hz ODR
    Delay 5ms;                                                        // the max time of 3.8ms from datasheet
    Write value of 0x15 to register 0x7E;    // optional, set GYR to normal mode, by default GYR is +/-2000dps full scale range and 100Hz ODR
    Delay 80ms;                                                     // the max time of 80ms from datasheet

    unsigned char value = read register 0x03;

    If (value == 0x14) then it means both ACC and GYR are in normal mode now

    In your loop function for example you can burst read BMI160 data registers from 0x0C to 0x17 total 12 bytes in one single I2C transaction at 1s time interval. Then you can plot Ax, Ay, Az values on the terminal to see if you can get about 16384 integer when you place any axis pointing to sky and about -16384 integer when any axis is pointing to ground.

    If yes, then you can change BMI160 ACC full scale range to +/-8g by writing the value of 0x08 to register 0x41 and then repeat the above steps. You should get about 4096 integer when you place any axis pointing to sky and about -4096 integer when any axis is pointing to ground.

    Thanks.

     

    sensor512
    New Poster

    Re: BMI160 Sensor data conversion

    Hello @FAE_CA1 ,

    Thanks again for showing me the method. I have written the code based on your instructions, and it worked, but when I went back to the self-test code, the accelerometer value changed back to the same old wrong value. I am unable to preserve the calibration data. Am I missing something, or, by mistake, have I overwritten the calibration data? I would appreciate it greatly if you could tell me how to keep the calibration data intact.

    Thanks

    FAE_CA1
    Community Moderator

    Re: BMI160 Sensor data conversion

    Hi,

    BMI160 self-test is to check if the ACC and GYR work properly or not after BMI160 is soldered on the PCB board. You said that you are able to get correct values from ACC and GYR from my instructions above. Then you don't need to go back to self-test. If you do, then please perform a soft-reset by writing value of 0xB6 to register 0x7E and then delay 100ms so that BMI160 goes back to default state. Then you can configure BMI160 again to get sensor data.

    I am not sure what you mean by calibration data. You will not have access to the BMI160 calibration parameters in each sensor's NVM. But if you want to do a quick inline calibration, then please see the attached "How to perform BMI160 inline calibration ver1.1.pdf".

    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