Bosch Sensortec Community

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

    BSXlite integration

    BSXlite integration

    George
    Member

    Dear community,

    I am currently integrating the Bosch BSXlite library into my IMU project, working with the BMI088 and the BMX160.

    Since the sensors accelerometer range can be chosen to be 3, 6, 12 or 24g (BMI088) and 2, 4, 8 or 16g (BMX160), resulting in different g per LSB- measurements, I wonder how to set up the range using the BSXlite library (which itself requires the input to be in LSB) to fetch valid output.

    I could not find any instructions regarding this in the integration/api documentation.

    I did find the bsx_set_accrange(BSX_U8) function in the library's header files, which is only defined for BSX_ACCRANGE_2G, 4G, 8G and 16G, hinting to only be compatible with the BMX160 (though bmi088  links to the bsx library as well).

    Am I supposed and if so how, to set up the range of the used sensors within my BSXlite code? (I am aware that with BSXlite, I probably won't have to set the gyroscope's and the magnetometer's range since they are fixed to be 500dps and 16uT/LSB).

    Appreciate any help.

    Best regards,
    George

    6 REPLIES 6

    Vincent
    Community Moderator
    Community Moderator

    BSX_dostep takes sensor input as physical unit:

    accel -> g

    gyro -> degree per second

    mag -> uT

    So you can select what ever you want in sensor side, then convert it to physical unit before call BSX  thread

    Hi Vincent, 

    thanks a lot for your reply!

    According to the "BSXlite_API_Documentation" and "BSXlite_LibraryIntegrationGuideline" -pdf this does not seem to be correct. See below:

    They all state the library's input has to be in LSB format. Is this a documentation error? If so, does 'bsx_dopreprocess'  require input in the units suggested by you as well? Thanks a lot. 

     

    libraryInput.jpeg

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

    mainProcess.jpeg

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

    dostep.jpg

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

    The LSB format in the document can be used for some sensors' (such as bmi160) default configuration. For example, 

    ACC: if we set range = +/- 2g, the input acc data unit =1 LSB = 2g/2^15 = g/16384 = 0.061 mg. (resolution = 0.061mg/LSB)
    GYRO: if we set range = +/-500 dps, the input gyro data unit =1 LSB = 500dps/2^15 = 0.0153 dps

    It is recommended to directly use the physical units as the input of Bsxlite. Based on the verfication results, we can get the following input uints:
    ACC: 0.061 mg
    GYRO: 0.0153 dps
    MAG: 0.1 uT

    Hi xuchang and thanks for replying.

    I still don't quite understand how this should work. 

    I fetch the sensor data with the BMI160 API using 'bmi160_get_sensor_data'. This function returns a bmi160_sensor_data structs, which contains the members int16_t x, int16_t y, int16_t z, and uint32_t sensortime. The x-value for the accelerometer can be converted to a value in g by knowing the set range and thereby the resolution.

    BSXLite's 'bsx_dostep' expects type 'libraryinput_t' as input, which has the member 'sensordata_t acc', which itself has the members 
    'ts_dataxyzs32 data'  and 'unsigned int (32Bit) time_stamp', where 'ts_dataxyzs32' consists of the members x,y and z in signed int (32Bit).
     
    If 'bmi160_get_sensor_data' returns a reading of e.g. 10 for acc.x, which is at a range of +/- 2g and resolution = 0.061mg/LSB , this means we have 0.61mg measured by the sensor in x-axis. How am I supposed to give this float value as an input to the bsx_dostep-function,that needs a signed int-input?
     
    On the other hand, if I assume bsxlite needs accelerometer input in unit g and then pass the  int16_t x-value fetched from bmi160_get_sensor_data to the bsxLite library (bsx_dostep), how does the library know if this value is measured in a resolution of 0.061mg/LSB (+/- 2g) or e.g.  0.122mg/LSB for +/- 4g?
     
    Thanks a lot for helping me out with this and have a great day.
     
    Best regards,
    George
     
    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