I experience the same issue but even when operation mode set to 0x8 I still get 0s. I do set power mode to Normal. I did notice difference that switching power mode can get sensor to spit out 0s but now even when I don't switch power mode I still get 0s. Here is my code example void bno055_init_test(BNO055_imuReadOutData_t* bmo055OutData) { /*********read raw accel data***********/ bmo055OutData->accel_datax = BNO055_INIT_VALUE; // variable used to read the accel x data bmo055OutData->accel_datay = BNO055_INIT_VALUE; // variable used to read the accel y data bmo055OutData->accel_dataz = BNO055_INIT_VALUE; // variable used to read the accel z data //struct bno055_accel_t accel_xyz; /*********read raw mag data***********/ bmo055OutData->mag_datax = BNO055_INIT_VALUE; // variable used to read the mag x data bmo055OutData->mag_datay = BNO055_INIT_VALUE; // variable used to read the mag y data bmo055OutData->mag_dataz = BNO055_INIT_VALUE; // variable used to read the mag z data //struct bno055_mag_t mag_xyz; /***********read raw gyro data***********/ bmo055OutData->gyro_datax = BNO055_INIT_VALUE; // variable used to read the gyro x data bmo055OutData->gyro_datay = BNO055_INIT_VALUE; // variable used to read the gyro y data bmo055OutData->gyro_dataz = BNO055_INIT_VALUE; // variable used to read the gyro z data //struct bno055_gyro_t gyro_xyz; /*************read raw Euler data************/ bmo055OutData->euler_data_h = BNO055_INIT_VALUE; // variable used to read the euler h data bmo055OutData->euler_data_r = BNO055_INIT_VALUE; // variable used to read the euler r data bmo055OutData->euler_data_p = BNO055_INIT_VALUE; // variable used to read the euler p data //struct bno055_euler_t euler_hrp; // structure used to read the euler hrp data /************read raw quaternion data**************/ bmo055OutData->quaternion_data_w = BNO055_INIT_VALUE; // variable used to read the quaternion w data bmo055OutData->quaternion_data_x = BNO055_INIT_VALUE; // variable used to read the quaternion x data bmo055OutData->quaternion_data_y = BNO055_INIT_VALUE; // variable used to read the quaternion y data bmo055OutData->quaternion_data_z = BNO055_INIT_VALUE; // variable used to read the quaternion z data //struct bno055_quaternion_t quaternion_wxyz; // structure used to read the quaternion wxyz data /************read raw linear acceleration data***********/ bmo055OutData->linear_accel_data_x = BNO055_INIT_VALUE; // variable used to read the linear accel x data bmo055OutData->linear_accel_data_y = BNO055_INIT_VALUE; // variable used to read the linear accel y data bmo055OutData->linear_accel_data_z = BNO055_INIT_VALUE; // variable used to read the linear accel z data //struct bno055_linear_accel_t linear_acce_xyz; // structure used to read the linear accel xyz data /*****************read raw gravity sensor data****************/ bmo055OutData->gravity_data_x = BNO055_INIT_VALUE; // variable used to read the gravity x data bmo055OutData->gravity_data_y = BNO055_INIT_VALUE; // variable used to read the gravity y data bmo055OutData->gravity_data_z = BNO055_INIT_VALUE; // variable used to read the gravity z data //struct bno055_gravity_t gravity_xyz; /* structure used to read the gravity xyz data u8 power_mode = BNO055_INIT_VALUE; /*Start initialization*/ I2C_routine_BNO055(); comres = bno055_init(&bno055); //checks ID versions power_mode = BNO055_POWER_MODE_NORMAL; comres += bno055_set_power_mode(power_mode); comres = bno055_set_operation_mode(BNO055_OPERATION_MODE_IMUPLUS); //BNO055_OPERATION_MODE_CONFIG //HAL_Delay(650); /*----------------------------------------*/ success = bno055_read_register(BNO055_SYS_STAT_ADDR, &err_bmo055_buf[1], BNO055_GEN_READ_WRITE_LENGTH); if ((err_bmo055_buf[1]==0x01) || (err_bmo055_buf[0]!=0x0)){ success = bno055_read_register(BNO055_SYS_ERR_ADDR, &err_bmo055_buf[0], BNO055_GEN_READ_WRITE_LENGTH); while (err_bmo055_buf[0]!=0x00){ /*Software system reset */ success = bno055_read_register(BNO055_SYS_TRIGGER_ADDR, &bno055_sys_trig, BNO055_GEN_READ_WRITE_LENGTH); write_buf = (bno055_sys_trig | BNO055_SYS_RST_MSK); bno055_set_operation_mode(BNO055_OPERATION_MODE_CONFIG);//not sure if I need this but setting it to write to the register success = bno055_write_register(BNO055_SYS_TRIGGER_ADDR, &write_buf, BNO055_GEN_READ_WRITE_LENGTH); /*------------------------------------------------------*/ HAL_Delay(650); //just in case we need a little time to reset I2C_routine_BNO055(); //assign functions comres = bno055_init(&bno055); //checks ID versions comres += bno055_set_power_mode(BNO055_POWER_MODE_NORMAL); //set power mode bno055_set_operation_mode(BNO055_OPERATION_MODE_AMG);//set operation mode success = bno055_read_register(BNO055_SYS_STAT_ADDR, &err_bmo055_buf[1], BNO055_GEN_READ_WRITE_LENGTH); success = bno055_read_register(BNO055_SYS_ERR_ADDR, &err_bmo055_buf[0], BNO055_GEN_READ_WRITE_LENGTH); count = count + 1; } } //set to use external oscillator bno055_set_operation_mode(BNO055_OPERATION_MODE_CONFIG); success = bno055_read_register(BNO055_SYS_TRIGGER_ADDR, &bno055_sys_trig, BNO055_GEN_READ_WRITE_LENGTH); write_buf = (bno055_sys_trig | BNO055_CLK_SRC_MSK); //0x80; success = bno055_write_register(BNO055_SYS_TRIGGER_ADDR, &write_buf, BNO055_GEN_READ_WRITE_LENGTH); bno055_set_operation_mode(BNO055_OPERATION_MODE_AMG); success = bno055_read_register(BNO055_SELFTEST_RESULT_ADDR, &err_bmo055_buf[4], BNO055_GEN_READ_WRITE_LENGTH); if (err_bmo055_buf[4]!=0xf){ success = bno055_read_register(BNO055_SYS_TRIGGER_ADDR, &bno055_sys_trig, BNO055_GEN_READ_WRITE_LENGTH); write_buf = (bno055_sys_trig | BNO055_SELFTEST_MSK); //0x01; //Do self-test success = bno055_write_register(BNO055_SYS_TRIGGER_ADDR, &write_buf, BNO055_GEN_READ_WRITE_LENGTH); } success = bno055_read_register(BNO055_SELFTEST_RESULT_ADDR, &err_bmo055_buf[4], BNO055_GEN_READ_WRITE_LENGTH); success = bno055_read_register(BNO055_SYS_CLK_STAT_ADDR, &err_bmo055_buf[2], BNO055_GEN_READ_WRITE_LENGTH); success = bno055_read_register(BNO055_INTR_STAT_ADDR, &err_bmo055_buf[3], BNO055_GEN_READ_WRITE_LENGTH); success = bno055_read_register(BNO055_CALIB_STAT_ADDR, &err_bmo055_buf[5], BNO055_GEN_READ_WRITE_LENGTH); /*---------------------------------------*/ } BNO055_RETURN_FUNCTION_TYPE bno055_check_cal(bno055_calib* calib_results_struct){ success = bno055_get_accel_calib_stat(calib_results_struct->accel_calib_status); success = bno055_get_gyro_calib_stat(calib_results_struct->gyro_calib_status); success = bno055_get_sys_calib_stat(calib_results_struct->sys_calib_status); success = bno055_get_mag_calib_stat(calib_results_struct->mag_calib_status); } /* This API is an example for reading sensor data * \param: Structure where data will be stored * \return: None */ void bno055_data_readout_template(BNO055_imuReadOutData_t* bmo055OutData) { /* variable used to set the power mode of the sensor*/ u8 power_mode = BNO055_INIT_VALUE; /* For initializing the BNO sensor it is required to the operation mode * of the sensor as NORMAL * Normal mode can set from the register * Page - page0 * register - 0x3E * bit positions - 0 and 1*/ //power_mode = BNO055_POWER_MODE_NORMAL; /* set the power mode as NORMAL*/ //comres += bno055_set_power_mode(power_mode); /* For reading sensor raw data it is required to set the * operation modes of the sensor * operation mode can set from the register * page - page0 * register - 0x3D * bit - 0 to 3 * for sensor data read following operation mode have to set * SENSOR MODE * 0x01 - BNO055_OPERATION_MODE_ACCONLY * 0x02 - BNO055_OPERATION_MODE_MAGONLY * 0x03 - BNO055_OPERATION_MODE_GYRONLY * 0x04 - BNO055_OPERATION_MODE_ACCMAG * 0x05 - BNO055_OPERATION_MODE_ACCGYRO * 0x06 - BNO055_OPERATION_MODE_MAGGYRO * 0x07 - BNO055_OPERATION_MODE_AMG * based on the user need configure the operation mode*/ comres += bno055_set_operation_mode(BNO055_OPERATION_MODE_IMUPLUS); //BNO055_OPERATION_MODE_AMG /************************* START READ RAW SENSOR DATA****************/ /* Raw accel X, Y and Z data can read from the register * page - page 0 * register - 0x08 to 0x0D*/ comres += bno055_read_accel_x(&bmo055OutData->accel_datax); comres += bno055_read_accel_y(&bmo055OutData->accel_datay); comres += bno055_read_accel_z(&bmo055OutData->accel_dataz); comres += bno055_read_accel_xyz(&bmo055OutData->accel_xyz); /* Raw mag X, Y and Z data can read from the register * page - page 0 * register - 0x0E to 0x13*/ comres += bno055_read_mag_x(&bmo055OutData->mag_datax); comres += bno055_read_mag_y(&bmo055OutData->mag_datay); comres += bno055_read_mag_z(&bmo055OutData->mag_dataz); comres += bno055_read_mag_xyz(&bmo055OutData->mag_xyz); /* Raw gyro X, Y and Z data can read from the register * page - page 0 * register - 0x14 to 0x19*/ comres += bno055_read_gyro_x(&bmo055OutData->gyro_datax); comres += bno055_read_gyro_y(&bmo055OutData->gyro_datay); comres += bno055_read_gyro_z(&bmo055OutData->gyro_dataz); comres += bno055_read_gyro_xyz(&bmo055OutData->gyro_xyz); /************************* END READ RAW SENSOR DATA****************/ /************************* START READ RAW FUSION DATA ******** * For reading fusion data it is required to set the * operation modes of the sensor * operation mode can set from the register * page - page0 * register - 0x3D * bit - 0 to 3 * for sensor data read following operation mode have to set * FUSION MODE * 0x08 - BNO055_OPERATION_MODE_IMUPLUS * 0x09 - BNO055_OPERATION_MODE_COMPASS * 0x0A - BNO055_OPERATION_MODE_M4G * 0x0B - BNO055_OPERATION_MODE_NDOF_FMC_OFF * 0x0C - BNO055_OPERATION_MODE_NDOF * based on the user need configure the operation mode*/ // comres += bno055_set_operation_mode(BNO055_OPERATION_MODE_NDOF); /* Raw Euler H, R and P data can read from the register * page - page 0 * register - 0x1A to 0x1E */ comres += bno055_read_euler_h(&bmo055OutData->euler_data_h); comres += bno055_read_euler_r(&bmo055OutData->euler_data_r); comres += bno055_read_euler_p(&bmo055OutData->euler_data_p); comres += bno055_read_euler_hrp(&bmo055OutData->euler_hrp); /* Raw Quaternion W, X, Y and Z data can read from the register * page - page 0 * register - 0x20 to 0x27 */ comres += bno055_read_quaternion_w(&bmo055OutData->quaternion_data_w); comres += bno055_read_quaternion_x(&bmo055OutData->quaternion_data_x); comres += bno055_read_quaternion_y(&bmo055OutData->quaternion_data_y); comres += bno055_read_quaternion_z(&bmo055OutData->quaternion_data_z); comres += bno055_read_quaternion_wxyz(&bmo055OutData->quaternion_wxyz); /* Raw Linear accel X, Y and Z data can read from the register * page - page 0 * register - 0x28 to 0x2D */ comres += bno055_read_linear_accel_x(&bmo055OutData->linear_accel_data_x); comres += bno055_read_linear_accel_y(&bmo055OutData->linear_accel_data_y); comres += bno055_read_linear_accel_z(&bmo055OutData->linear_accel_data_z); comres += bno055_read_linear_accel_xyz(&bmo055OutData->linear_acce_xyz); /* Raw Gravity sensor X, Y and Z data can read from the register * page - page 0 * register - 0x2E to 0x33 */ comres += bno055_read_gravity_x(&bmo055OutData->gravity_data_x); comres += bno055_read_gravity_y(&bmo055OutData->gravity_data_y); comres += bno055_read_gravity_z(&bmo055OutData->gravity_data_z); comres += bno055_read_gravity_xyz(&bmo055OutData->gravity_xyz); /************************* END READ RAW FUSION DATA ************/ /*-----------------------------------------------------------------------* ************************* START DE-INITIALIZATION *********************** *-------------------------------------------------------------------------*/ /* For de - initializing the BNO sensor it is required * to the operation mode of the sensor as SUSPEND * Suspend mode can set from the register * Page - page0 * register - 0x3E * bit positions - 0 and 1*/ //power_mode = BNO055_POWER_MODE_SUSPEND; /* set the power mode as SUSPEND*/ //comres += bno055_set_power_mode(power_mode); /*---------------------------------------------------------------------* ************************* END DE-INITIALIZATION ********************** *---------------------------------------------------------------------*/ //return comres; bmo055OutData->comres = comres; }
... View more