From 34f53c14bf7838e5312801215bf6012f61137683 Mon Sep 17 00:00:00 2001 From: dino Date: Wed, 27 Nov 2019 12:28:17 +0100 Subject: [PATCH] Fixed sensor orientation --- boards/px4/fmu-v5x/init/rc.board_sensors | 4 ++-- src/drivers/imu/bmi088/BMI088_gyro.cpp | 13 ++++++------- src/drivers/imu/bmi088/BMI088_gyro.hpp | 3 ++- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/boards/px4/fmu-v5x/init/rc.board_sensors b/boards/px4/fmu-v5x/init/rc.board_sensors index 9c6fe00b0c..98e27e7f3c 100644 --- a/boards/px4/fmu-v5x/init/rc.board_sensors +++ b/boards/px4/fmu-v5x/init/rc.board_sensors @@ -16,10 +16,10 @@ mpu6000 -R 8 -s -T 20602 start ism330dlc start # Internal SPI bus BMI088 accel -bmi088 -A -R 10 start +bmi088 -A -R 12 start # Internal SPI bus BMI088 gyro -bmi088 -G -R 10 start +bmi088 -G -R 12 start # Possible external compasses ist8310 -C -b 1 start diff --git a/src/drivers/imu/bmi088/BMI088_gyro.cpp b/src/drivers/imu/bmi088/BMI088_gyro.cpp index 35d96bbc54..a58d4c0848 100644 --- a/src/drivers/imu/bmi088/BMI088_gyro.cpp +++ b/src/drivers/imu/bmi088/BMI088_gyro.cpp @@ -367,7 +367,6 @@ BMI088_gyro::measure() check_registers(); - // Get the last temperature from the accelerometer (the Gyro does not have its own temperature measurement) _last_temperature = _accel_last_temperature_copy; @@ -376,14 +375,14 @@ BMI088_gyro::measure() report.gyro_y = bmi_gyroreport.gyro_y; report.gyro_z = bmi_gyroreport.gyro_z; - if ((bmi_gyroreport.chip_id & 0x0f) != BMI088_GYR_WHO_AM_I) { - // all zero data - probably an SPI bus error + if ((bmi_gyroreport.chip_id) != BMI088_GYR_WHO_AM_I) { + // If chip id is not right, assume a bus transfer error perf_count(_bad_transfers); perf_end(_sample_perf); - // // note that we don't call reset() here as a reset() - // // costs 20ms with interrupts disabled. That means if - // // the bmi088 does go bad it would cause a FMU failure, - // // regardless of whether another sensor is available, + // note that we don't call reset() here as a reset() + // costs 20ms with interrupts disabled. That means if + // the bmi088 does go bad it would cause a FMU failure, + // regardless of whether another sensor is available, return; } diff --git a/src/drivers/imu/bmi088/BMI088_gyro.hpp b/src/drivers/imu/bmi088/BMI088_gyro.hpp index feac4abbaa..0d53dff653 100644 --- a/src/drivers/imu/bmi088/BMI088_gyro.hpp +++ b/src/drivers/imu/bmi088/BMI088_gyro.hpp @@ -251,7 +251,8 @@ private: */ struct BMI_GyroReport { uint8_t cmd; - uint16_t chip_id; + uint8_t chip_id; // Read to check if bus is workig + uint8_t ununsed; int16_t gyro_x; int16_t gyro_y; int16_t gyro_z;