Bosch Sensortec Community

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

    BMI270 Motionless SENS Error Compensation (Re-Trimming CRT) - new gyroscope gain value location?

    BMI270 Motionless SENS Error Compensation (Re-Trimming CRT) - new gyroscope gain value location?

    super_mcu
    New Poster

    After a success CRT (GYR_GAIN_STATUS.g_trig_status reports a successfull CRT run), I tried to get the new gyro gain values from below locattions:

    - register 0x78, 0x79, 0x7A

    - GYR_GAIN_UPD_1, GYR_GAIN_UPD_2, GYR_GAIN_UPD_3 in page 1

    But all values are "0".  

    I wonder how to get the new gyro gain values, wihch will be programmed to NVM later. Thanks.

    6 REPLIES 6

    Yanchao
    Community Moderator
    Community Moderator

    Hi,

    The formal BMI270 API include crt process, so you could compare your code with this API to confirm if the crt done and sucess.

    And then, you could check the GYR_GAIN_UPD_1, GYR_GAIN_UPD_2, GYR_GAIN_UPD_3 in page 1.

    Best regards.

     

    Hi,

    Yes, the CRT is done and success by verifying GYR_GAIN_STATUS.g_trig_status.

    But the reading value of GYR_GAIN_UPD_1, GYR_GAIN_UPD_2, GYR_GAIN_UPD_3 in page 1 are always "0".

    Yanchao
    Community Moderator
    Community Moderator

    Hi,

    I test BMI270 CRT and read gain val with BMI270 API, code and log as bellow. So, please review BMI270 API code to check your process.

    Another suggestion, during make CRT if move your board, please check the CRT fail status.

     

    Running example 'bmi270_execute_crt.exe' ...
    
     ratio_x:0, ratio_y:0, ratio_z:0, 
    
     CRT completed successfully
    
     ratio_x:6, ratio_y:116, ratio_z:119, 
    
    Operation finished successfully

     

     

     

    /* This function starts the execution of program */
    int main(void)
    {
        /* Structure to define BMI2 sensor configurations */
        struct bmi2_dev bmi2;
    
        /* Variable to define result */
        int8_t rslt;
    
        /* Bus configuration : I2C */
        #if BMI270_INTERFACE_I2C == 1
    
        /* To initialize the hal function */
        bmi2xy_hal_i2c_init();
        bmi2.dev_id = BMI2_I2C_PRIM_ADDR;
        bmi2.intf = BMI2_I2C_INTERFACE;
        bmi2.read = bmi2xy_hal_i2c_bus_read;
        bmi2.write = bmi2xy_hal_i2c_bus_write;
    
        /* Bus configuration : SPI */
        #elif BMI270_INTERFACE_SPI == 1
    
        /* To initialize the hal function */
        bmi2xy_hal_spi_init();
        bmi2.dev_id = SPI_CS;
        bmi2.intf = BMI2_SPI_INTERFACE;
        bmi2.read = bmi2xy_hal_spi_bus_read;
        bmi2.write = bmi2xy_hal_spi_bus_write;
        #endif
    
        bmi2.read_write_len = 32;
        bmi2.delay_us = bmi2xy_hal_delay_usec;
    
        /* Config file pointer should be assigned to NULL, so that default file address is assigned in bmi270_init */
        bmi2.config_file_ptr = NULL;
    
        /* To Initialize bmi270 */
        rslt = bmi270_init(&bmi2);
        print_rslt(rslt);
    
    #if (CRT_CHECK==1)
    
        struct bmi2_gyro_user_gain_data g_usr_gain;
        g_usr_gain.x = g_usr_gain.y = g_usr_gain.z = 0;
        
    #endif
    
    
        if (rslt == BMI2_OK)
        {
    // ZYC, 20210308
    #if (CRT_CHECK==1)
    
            if (rslt == BMI2_OK)
    //        if ((rslt == BMI2_OK)/* && (user_gain != NULL)*/)
            {
                /* Get the user gain */
                bmi2_read_gyro_user_gain(&g_usr_gain, &bmi2);
    
                printf("\r\n ratio_x:%d, ratio_y:%d, ratio_z:%d, ", g_usr_gain.x, g_usr_gain.y, g_usr_gain.z );
            }
    #endif
        
            /* This API is to run the CRT process */
            /* Do not shake the board for CRT test. If so, it will throw an abort error */
            rslt = bmi2_do_crt(&bmi2);
            print_rslt(rslt);
    
            if (rslt == BMI2_OK)
            {
                printf("\r\n CRT completed successfully");
            }
    
    // ZYC, 20210308
    #if (CRT_CHECK==1)
    
            if (rslt == BMI2_OK)
    //        if ((rslt == BMI2_OK)/* && (user_gain != NULL)*/)
            {
                /* Get the user gain */
                bmi2_read_gyro_user_gain(&g_usr_gain, &bmi2);
    
                printf("\r\n ratio_x:%d, ratio_y:%d, ratio_z:%d, ", g_usr_gain.x, g_usr_gain.y, g_usr_gain.z );
            }
    #endif
        }
    
        return rslt;
    }
    

     

     

     

    Hi Yanchao,

    Thanks for your help. Yes, I got the gyro gain values from 0x78, 0x79 and 0x7A now. 

    I wonder how to interpret the these values into Sensitivity Scalar? 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