Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMX055 Magnetometer self test

    Highlighted
    New Poster

    BMX055 Magnetometer self test

    Hello,

    I'm using the BMX055 in a company's project. I read the data using the bma2x2_driver, bmg160_driver and bmm150_sensor_api for ACC, GYRO and MAG respectively.

    The data coming from ACC and DATA seem to be fine, whereas the data from the MAG doesn't seem relyable.

    As a preliminary test I'm using the smartphone compass to detect the North, in order to compare it with the result I get from the BMX055. Since the results are very different and the readings from the BMX055 are varying over time I tried to perform a self test:

    - the normal test completes successfully

    - the advanced test always fails (I used 3 different boards)

    Here is a snipped of my code:

    static struct bmm150_dev dev;
     
    s8 initMAG(void) {
        s8 ret = BMM150_OK;

        /* Sensor interface over I2C */
        dev.dev_id = BMM150_DEFAULT_I2C_ADDRESS;
        dev.intf = BMM150_I2C_INTF;
        dev.read = user_i2c_read;
        dev.write = user_i2c_write;
        dev.delay_ms = user_delay_ms;
        
        ret = bmm150_init(&dev);

        if(ret != 0) {
            ESP_LOGE(TAG_IMU, "Error initializing the magnetometer. Error code: %d", ret);
        }
        
        ret += perform_mag_self_tests();

        /* Setting the power mode as normal */
        dev.settings.pwr_mode = BMM150_NORMAL_MODE;
        ret += bmm150_set_op_mode(&dev);
        
        /* Setting the preset mode as Low power mode 
        i.e. data rate = 10Hz XY-rep = 1 Z-rep = 2*/
        dev.settings.preset_mode = BMM150_PRESETMODE_REGULAR;
        ret += bmm150_set_presetmode(&dev);

        
        return ret; 
    }
     

    where:

    int8_t perform_mag_self_tests(void)
    {
        int8_t rslt;

        /* Perform Normal Self test */
        rslt = bmm150_perform_self_test(BMM150_NORMAL_SELF_TEST, &dev);
        ESP_LOGI(TAG_IMU, "NORMAL SELF TEST RESULT :  %d", rslt);
        
        /* Validate normal self test result */
        if (rslt == BMM150_OK) {
            ESP_LOGI(TAG_IMU, "Normal Self test passed");
        } else {
            ESP_LOGE(TAG_IMU, "Normal Self test failed");
        }
        /* Perform Advanced Self test */
        rslt |= bmm150_perform_self_test(BMM150_ADVANCED_SELF_TEST, &dev);
        ESP_LOGI(TAG_IMU, "ADVANCED SELF TEST RESULT :  %d", rslt);

        /* Validate Advanced self test result */
        if (rslt == BMM150_OK) {
            ESP_LOGI(TAG_IMU, "Advanced Self test passed");
        } else {
            ESP_LOGE(TAG_IMU, "Advanced Self test failed");
        }
        
        return rslt;
    }
     
     
    Could you please help me identifying the problem?
     
    Thank you!
    1 REPLY 1
    Highlighted
    Occasional Contributor

    Re: BMX055 Magnetometer self test

    Please make sure the magnetic field environment of advanced self-test is stable, and do not move the device under testing.

    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