Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMM150 Trim Values & Z repetitions

    BMM150 Trim Values & Z repetitions

    Vinod
    New Poster

    I am working with Arduino Nano BLE33_Sense Rev. 2 MCU.  This MCU has built-in sensors, BMI270, BMM150, etc.  I am writing app for BMM150 to determine heading.  I have extracted the trim data from the trim registers.  These data are partially in agreement with the trim data shown in one of your data sheet, shown below:

                                                 BOSCH Data                      Data from

                                                                                              Arduino MCU

    dig_X1                         0                                                  0

    dig_Y1                          0                                                  0

    dig_X2                         26                                               25                         different

    dig_Y2                          26                                               25                         different

    dig_xy1                        29                                               29

    dig_xy2                        -3                                                -3

    dig_z1                          22752                                        21463                  different

    dig_z2                          737                                             770                       different

    dig_z3                          -1035                                         0                            different

    dig_z4                          0                                                  0

    dig_xyz1                      6753                                           7019                     different

    I am not sure what to make of the difference.  Please help me if the difference is due to Arduino with built-in sensors or I am making some mistake in extracting the data.  By the way, one the app supplied by Arduino for BMM150 also reproduced the same data as mine.

     

    A second question I have is regarding preset values for REPZ repetitions (register 0x52).  According to the definition input value should be 14 (15 -1) for BMM150_REPZ_REGULAR preset.  Please help me, if my interpretation is flawed. What is the significance of the repetitions?

    Thanks, Vinod

    1 REPLY 1

    BSTRobin
    Community Moderator
    Community Moderator

    Hi Vinod,

    You could refer BMM150 official sensor API and example code to get sensor data, by call bmm150_read_mag_data() to get compensated x, y, z mag data.
    https://github.com/boschsensortec/BMM150-Sensor-API/tree/master/examples/generic

    In BMM150 sensor API, z_rep was set according different preset mode.

    /*!
    * @brief This API is used to set the preset mode of the sensor.
    */
    int8_t bmm150_set_presetmode(struct bmm150_settings *settings, struct bmm150_dev *dev)
    {
    int8_t rslt;
    uint8_t preset_mode;

    /* Check for null pointer in the device structure */
    rslt = null_ptr_check(dev);

    /* Proceed if null check is fine */
    if (rslt == BMM150_OK)
    {
    preset_mode = settings->preset_mode;

    switch (preset_mode)
    {
    case BMM150_PRESETMODE_LOWPOWER:

    /* Set the data rate x,y,z repetition
    * for Low Power mode
    */
    settings->data_rate = BMM150_DATA_RATE_10HZ;
    settings->xy_rep = BMM150_REPXY_LOWPOWER;
    settings->z_rep = BMM150_REPZ_LOWPOWER;
    rslt = set_odr_xyz_rep(settings, dev);
    break;
    case BMM150_PRESETMODE_REGULAR:

    /* Set the data rate x,y,z repetition
    * for Regular mode
    */
    settings->data_rate = BMM150_DATA_RATE_10HZ;
    settings->xy_rep = BMM150_REPXY_REGULAR;
    settings->z_rep = BMM150_REPZ_REGULAR;
    rslt = set_odr_xyz_rep(settings, dev);
    break;
    case BMM150_PRESETMODE_HIGHACCURACY:

    /* Set the data rate x,y,z repetition
    * for High Accuracy mode *
    */
    settings->data_rate = BMM150_DATA_RATE_20HZ;
    settings->xy_rep = BMM150_REPXY_HIGHACCURACY;
    settings->z_rep = BMM150_REPZ_HIGHACCURACY;
    rslt = set_odr_xyz_rep(settings, dev);
    break;
    case BMM150_PRESETMODE_ENHANCED:

    /* Set the data rate x,y,z repetition
    * for Enhanced Accuracy mode
    */
    settings->data_rate = BMM150_DATA_RATE_10HZ;
    settings->xy_rep = BMM150_REPXY_ENHANCED;
    settings->z_rep = BMM150_REPZ_ENHANCED;
    rslt = set_odr_xyz_rep(settings, dev);
    break;
    default:
    rslt = BMM150_E_INVALID_CONFIG;
    break;
    }
    }

    return rslt;
    }

    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