Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BNO055 heading wrong after calibration recall

    Digisolve
    Established Member

    BNO055 heading wrong after calibration recall

    Using the BNO055 I find it gives the different heading reading depending on the orientation when I power up.

    I'm using NDOF (OPR MODE = 0xC0) & I've calibrated until I get 3 is all the cal status bits (CALIB_STAT = 0xFF). I then save the OFFSET & RADIUS reg to non-volatile ram (regs 0x55 thru to 0x6A). I then power the unit up point in one direction & get (say) 160 degees. I then power off, rotate thru 90 degees & power up again. I then move it back to the original direction & it read 114 degees

    I staying in the same place & keeping the pitch & roll very close to 0 degees.

    9 REPLIES 9
    BSTRobin
    Community Moderator

    Re: BNO055 heading wrong after calibration recall

    Hi Digisolve,

    Do you know what the surrounding magnetic field environment is like?

    Digisolve
    Established Member

    Re: BNO055 heading wrong after calibration recall

    I have run tests outside in an open garden in daylight. There are a few houses about 20 meters away. There are no overhead power lines

    The units is fully calibrated in this location & the offset & raduis data is saved. When I power the unit up & restore the cal data I heading is unreliable power up in different positions & then tun to the same point.

    e.g. if I power up point in direction A i get A degrees. when I power up at 90 degres then turn to direction A I no longer get A degrees.

    This is my start & calibration load functions:

    #define BNO055_CAL_DATA_START   BNO055_ACCEL_OFFSET_X_LSB_ADDR
    #define BNO055_CAL_DATA_SIZE    (BNO055_MAG_RADIUS_MSB_ADDR - BNO055_CAL_DATA_START + 1)
    
    void bno055_init(void)
    {
        Delay(TICK_100MS);
        
        COMPASS_RESET = 0;
        Delay(TICK_10MS);
        COMPASS_RESET = 1;
        
        Delay(7*TICK_100MS);    // wait compass POR
        
        /* switch back to page 0 */
        BNO055_I2C_Write(BNO055_PAGE_ID_ADDR, PAGE0);
        
        //    Delay(TICK_10MS);
        
        /* read chip IDs (for debug only)*/
        BNO055_I2C_Read(BNO055_CHIP_ID_ADDR);
        BNO055_I2C_Read(BNO055_ACCEL_REV_ID_ADDR);
        BNO055_I2C_Read(BNO055_MAG_REV_ID_ADDR);
        BNO055_I2C_Read(BNO055_GYRO_REV_ID_ADDR);
        BNO055_I2C_Read(BNO055_SW_REV_ID_LSB_ADDR);
        BNO055_I2C_Read(BNO055_SW_REV_ID_MSB_ADDR);
        BNO055_I2C_Read(BNO055_BL_REV_ID_ADDR);
        
        /* Wait till restart */
        while(BNO055_I2C_Read(BNO055_SELFTEST_RESULT_ADDR) != 0x0F )
        {
            Delay(TICK_10MS);
        }
        
        /* Set to config mode */
        BNO055_I2C_Write(BNO055_OPR_MODE_ADDR, BNO055_OPERATION_MODE_CONFIG);
        
        /* Set to normal power mode */
        BNO055_I2C_Write(BNO055_PWR_MODE_ADDR, BNO055_POWER_MODE_NORMAL);
        
        /* Set the output units */
        BNO055_I2C_Write(BNO055_UNIT_SEL_ADDR, 0x00); 
        
        // use external clock //
        BNO055_I2C_Write(BNO055_SYS_TRIGGER_ADDR, 0x80); 
        Delay(TICK_10MS);
        
        while(BNO055_I2C_Read(BNO055_SYS_CLK_STAT_ADDR) & 1)
        {
            Delay(TICK_10MS);
        }
        
        if((BNO055_I2C_Read(BNO055_SYS_TRIGGER_ADDR) & 0x80) == 0)
            while(1);   // !!! EXTERNAL CLOCK SELECTION FAILED
        
        /* Set the axis map (P2)*/
        BNO055_I2C_Write(BNO055_AXIS_MAP_CONFIG_ADDR, xyz_table[XYZ_MODE].map);
        BNO055_I2C_Write(BNO055_AXIS_MAP_SIGN_ADDR,   xyz_table[XYZ_MODE].sign);
        
        // Load calibration Profile //
        if(inhibit_profile == TRUE)
        {
            inhibit_profile = FALSE; 
        }
        else
        {
            BNO055_Load_Calibration_Profile();    
        }
        
        /* Set the requested operating mode (see section 3.3) */
        BNO055_I2C_Write(BNO055_OPR_MODE_ADDR, OPERATION_MODE);
        Delay(TICK_10MS);
    }
    
    void BNO055_Load_Calibration_Profile(void)
    {  
        S16 profile_data[sizeof(NvBuff.CompassProfile)/sizeof(NvBuff.CompassProfile[0])];
        U8 flash_loop ;
        
        for(flash_loop = 0; flash_loop < sizeof(profile_data)/sizeof(profile_data[0]); flash_loop++)
        {    
            profile_data[flash_loop] = NvBuff.CompassProfile[flash_loop];
        }
        
        BNO055_I2C_Write(BNO055_OPR_MODE_ADDR, BNO055_OPERATION_MODE_CONFIG);
        Delay(TICK_10MS);
    
        BNO055_I2C_WriteArray(BNO055_CAL_DATA_START, (U8*)profile_data, sizeof(profile_data));
        
        BNO055_I2C_Write(BNO055_OPR_MODE_ADDR, OPERATION_MODE);
        Delay(TICK_10MS);
    }

     

    Digisolve
    Established Member

    Re: BNO055 heading wrong after calibration recall

    Please can I get some feedback. My client is chasing me daily. Thank you

    BSTRobin
    Community Moderator

    Re: BNO055 heading wrong after calibration recall

    Hi Digisolve,

    After you call BNO055_Load_Calibration_Profile(), you need to wait calibration status to reach 3.

    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