Bosch Sensortec Community

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

    An issue at generate quaternion on BMX160

    An issue at generate quaternion on BMX160

    coder
    Member

    Dear moderators and engineers!

    I have encountered problems when using BSXLite to generate quaternions on BMX160, as described below. Previously considering BMI160+BMM150, the problem was the same. Later, because BOSCH sales staff suggested using BMX160, the problem also exists. I think it is a simple link that has a problem. Please help me check it out:

    Chip: BMX160, 

    MCU: Cortex M3, 

    Language: C programming, 

    Compiler Environment: MDK5

    System situation: BLE-Stack

     

    1. The main functions initialization

    11.jpg

    ...

    issue1.jpg

    2. void my_bsx_init() Functions achieve as follows:

    lib_init.png

     

     

     

     

     

     

     

     

     

     

     

     

     

    3. Operate Algorithm library, updataing value of sensors. Program will run to this function per 30mS

    22.jpg

    My Bsx step process Functions achieve as below:

    33.jpg

    4. Get quaternion,  Program will call follows functions to take quaternion

    44.jpg

     Finally no changes with quaternion

     

     

     

    7 REPLIES 7

    Dear Marko Njirjak and Moderator

    Thanks for your help!

    Yes,  I have got a meaningful quaternion. Different sensor range settings may cause some errors (such as the sampling frequency you mentioned), and I am trying more.
    If you have any suggestions for sensor settings, please let me know, this will be beneficial to my debugging.

    Thank you very much for your help!

    Andy

    mnjirjak
    Established Member

    Dear coder,

    here are the settings that I use in my project.

     

    //Accelerometer
    bmi.accel_cfg.power = BMI160_ACCEL_NORMAL_MODE;
    bmi.accel_cfg.bw = BMI160_ACCEL_BW_NORMAL_AVG4;
    bmi.accel_cfg.range = BMI160_ACCEL_RANGE_2G;
    bmi.accel_cfg.odr = BMI160_ACCEL_ODR_100HZ;
    
    //Gyroscope
    bmi.gyro_cfg.odr = BMI160_GYRO_ODR_100HZ;
    bmi.gyro_cfg.range = BMI160_GYRO_RANGE_500_DPS;
    bmi.gyro_cfg.bw = BMI160_GYRO_BW_NORMAL_MODE;
    bmi.gyro_cfg.power = BMI160_GYRO_NORMAL_MODE;
    
    //Magnetometer
    bmm.settings.preset_mode = BMM150_PRESETMODE_REGULAR;
    APP_ERROR_CHECK(bmm150_set_presetmode(&bmm));
    bmm.settings.pwr_mode = BMM150_FORCED_MODE;
    APP_ERROR_CHECK(bmm150_set_op_mode(&bmm));
    bmi.aux_cfg.aux_odr = 6;    // I believe this is 25Hz, but an 8 works OK too (100Hz)
    bmi160_config_aux_mode(&bmi);

     

     

    Kind regards,

    Marko Njirjak

    Really Thanks! I am know basic applications of Quatrnion I think. 

    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