Thank you for your answers. My system based on a bno055 still doesn't work as it should be. Here's a listing of my algorithm and the behaviour of the bno055 sensor. '--------------------------------------------------------------------------------------
Call Bno_change_opr_mode(&B00000000) 'OPR_MODE= Config_mode
Call Bno_change_pwr_mode(&B00000000) 'PWR Mode= Normal
Waitms 200
'Select Use Ext.OSC / Perform Self Test
Call Bno_write(sys_trigger , &B10000001)
Waitms 1000
'======================================================================================
Call Bno_rd_unique_id
Waitms 100
'--------------------------------------------------------------------------------------
'Verify if the BNO-055 chip is present by reading Chip_id, Acc_id, Gyr_id and Mag_id
'and comparing them with the default values
'don't get out of the next loop until BNO-055 is detected
While Chip_ok <> 1
Call Bno_check_chip
Wend
Call Bno_st_result 'Read Self_test_result
Waitms 100
Call Bno_write(unit_sel , &B00000000)
'Calibration
Print "starting calibration sequence.."
Call Bno_change_opr_mode(&B00001100) 'OPR_MODE= Fusion_Nine_degree_of_freedom
Call Bno_rd_calib_status
Print "Calibrating Gyroscope "
Waitms 500
While Gyr_calib_status <> 3
Call Bno_rd_calib_status
Print " calib status: " ; Gyr_calib_status
Waitms 250
Wend
Print " Done !"
Waitms 500
Print "Calibrating Accelerometer "
Waitms 500
While Acc_calib_status <> 3
Call Bno_rd_calib_status
Print " calib status: " ; Acc_calib_status
Waitms 250
Wend
Print " Done !"
Waitms 500
Print "Calibrating Magnetometer "
Waitms 500
While Mag_calib_status <> 3
Call Bno_rd_calib_status
Print " calib status: " ; Mag_calib_status
Waitms 250
Wend
Print " Done !"
Waitms 500
Print "Calibrating System "
Waitms 500
While Sys_calib_status <> 3
Call Bno_rd_calib_status
Print " calib status: " ; Sys_calib_status
Waitms 250
Wend
Print " Done !"
Waitms 500
Print
Print
Call Bno_change_opr_mode(&B00000000) 'OPR_MODE= Config_mode
Print "press Key2 to overwrite calibration values in EEPROM"
While I <= 5
If Key2 = 0 Then
Call Bno_rd_calib_profile
Call Wr_eeprom_calib_profile
I = 5
End If
Waitms 500
Incr I
Wend
Print "Calibration successful !"
Waitms 2000
Print "Reading Data..."
Waitms 1000
Call Bno_change_opr_mode(&B00001100) 'OPR_MODE= Fusion_Nine_degree_of_freedom
do
Call Bno_recheck_calibration 'check Calibration to avoid drift in Acc/ Gyro/ Mag
Call Bno_quat_2_roll_pitch_yaw 'Read & Convert Quaternions to Roll, Pitch, Yaw angles [dps]
Waitms 20
loop
end used subroutines: Sub Bno_rd_calib_status
If Reg_page <> 0 Then Call Bno_change_reg_page(0) 'change page_id
I2cstart
I2cwbyte Bno_wr_addr 'BNO-055 I2C WRITE address
I2cwbyte Calib_stat 'Start from CALIB_STAT Register
I2crepstart 'Repeat Start Condition
I2cwbyte Bno_rd_addr 'BNO-055 I2C READ address
I2crbyte Read_byte , Nack 'read EUL_Heading_MSB
Calibration_status = Read_byte
I2cstop
Mag_calib_status.0 = Calibration_status.0
Mag_calib_status.1 = Calibration_status.1
Acc_calib_status.0 = Calibration_status.2
Acc_calib_status.1 = Calibration_status.3
Gyr_calib_status.0 = Calibration_status.4
Gyr_calib_status.1 = Calibration_status.5
Sys_calib_status.0 = Calibration_status.6
Sys_calib_status.1 = Calibration_status.7
End Sub
Sub Bno_rd_calib_profile
If Reg_page <> 0 Then Call Bno_change_reg_page(0) 'change page_id
I2cstart
I2cwbyte Bno_wr_addr 'BNO-055 I2C WRITE address
I2cwbyte Acc_offset_x_lsb 'Start from ACC_OFFSET_X_LSB Register
I2crepstart 'Repeat Start Condition
I2cwbyte Bno_rd_addr 'BNO-055 I2C READ address
'Multiple Read: Reg &H55 to &H6A
I2crbyte Read_byte , Ack 'read ACC_OFFSET_X_LSB
Aox_l = Read_byte
I2crbyte Read_byte , Ack 'read ACC_OFFSET_X_MSB
Aox_m = Read_byte
I2crbyte Read_byte , Ack 'read ACC_OFFSET_Y_LSB
Aoy_l = Read_byte
I2crbyte Read_byte , Ack 'read ACC_OFFSET_Y_MSB
Aoy_m = Read_byte
I2crbyte Read_byte , Ack 'read ACC_OFFSET_Z_LSB
Aoz_l = Read_byte
I2crbyte Read_byte , Ack 'read ACC_OFFSET_Z_MSB
Aoz_m = Read_byte
I2crbyte Read_byte , Ack 'read MAG_OFFSET_X_LSB
Mox_l = Read_byte
I2crbyte Read_byte , Ack 'read MAG_OFFSET_X_MSB
Mox_m = Read_byte
I2crbyte Read_byte , Ack 'read MAG_OFFSET_Y_LSB
Moy_l = Read_byte
I2crbyte Read_byte , Ack 'read MAG_OFFSET_Y_MSB
Moy_m = Read_byte
I2crbyte Read_byte , Ack 'read MAG_OFFSET_Z_LSB
Moz_l = Read_byte
I2crbyte Read_byte , Ack 'read MAG_OFFSET_Z_MSB
Moz_m = Read_byte
I2crbyte Read_byte , Ack 'read GYR_OFFSET_X_LSB
Gox_l = Read_byte
I2crbyte Read_byte , Ack 'read GYR_OFFSET_X_MSB
Gox_m = Read_byte
I2crbyte Read_byte , Ack 'read GYR_OFFSET_Y_LSB
Goy_l = Read_byte
I2crbyte Read_byte , Ack 'read GYR_OFFSET_Y_MSB
Goy_m = Read_byte
I2crbyte Read_byte , Ack 'read GYR_OFFSET_Z_LSB
Goz_l = Read_byte
I2crbyte Read_byte , Ack 'read GYR_OFFSET_Z_MSB
Goz_m = Read_byte
I2crbyte Read_byte , Ack 'read ACC_RADIUS_LSB
Ar_l = Read_byte
I2crbyte Read_byte , Ack 'read ACC_RADIUS_MSB
Ar_m = Read_byte
I2crbyte Read_byte , Ack 'read MAG_RADIUS_LSB
Mr_l = Read_byte
I2crbyte Read_byte , Nack 'read MAG_RADIUS_MSB. Last multiple Read operation send NACK
Mr_m = Read_byte
I2cstop
End Sub
Sub Bno_recheck_calibration
' Make sure the CALIB_STAT Register is ok
' if not reload the calibration values to avoid Acc/Gyro/Mag drift
Call Bno_rd_calib_status
If Calibration_status <= 62 Then
'calibration status is smaller than 0x00111111
'bit 7:6 (system calibration) are ignored here.
Set Wled
Call Rd_eeprom_calib_profile 'load calibration values from uC's EEPROM
Call Bno_wr_calib_profile 're-write BNO-055 calibration values
Call Bno_write(opr_mode , Ndof) 're-enter NDOF Fusion Mode
Waitms 100
Reset Wled
End If
End Sub Here's a short description of the BNO-055's behaviour: After the initial calibration, I get correct values for the Roll, Pitch, Yaw angles (based on the quaternions). When the de-calibration occurs (usually Mag Offset and Radius) the microcontroller detects this and reloads all the calibration values (acc offset x,y,z / gyro offset x,y,z / mag offset x,y,z / acc radius x,y,z / mag radius x,y,z) from it's eeprom and writes them to the BNO's registers. I do change the operation mode to config before doing this. After reloading I change the operation mode back to NDOF Fusion, and from now on the problem begins. I have a white LED which I use to indicate that the calibration values have been reloaded by shortly blinking once. It blinks more than 20 times then remains off for a few seconds, and then starts to blink again. So the BNO gets his initial calibration values back but for some reason, the calibration status remains smaller than 00111111. You notice I ignore bits 6 and 7 (system calibration). It's like it won't accept the values. I do my testing without moving the sensor too much. Sometimes it stays in the same position for a long time, nothing else is moving on the table or around it (no mag fields or other interferences) and it still becomes drifty ... The worse part is that, the roll pitch yaw angles are false after reloading the calibration values. Not always but most of the time. Only a complete system reset would help. So I keep the BNO board on the table, Yaw shows 150 degrees, 40 seconds later it decalibrates, I reload the calibration values several times .. because for some reason the calib_status won't get back to "11" from the first reload, and the yaw shows 24 degrees now and jumps all over the place. Again this happens completely random. Please help me solve this.
... View more