diff --git a/src/shared/boards/AnakinBoard.cpp b/src/shared/boards/AnakinBoard.cpp index f7f8e9bc0d8ff2a9fe5821c018d9ecd86c092b88..2c0fe8f9fa72a913056a3361c18f961ac37ae975 100644 --- a/src/shared/boards/AnakinBoard.cpp +++ b/src/shared/boards/AnakinBoard.cpp @@ -28,6 +28,8 @@ bool AnakinBoard::init() spiMS580301BA07::init(); mInited = true; + mS_MAX21105 = new max21105_t (max21105_t::ACC_FS_16G, + max21105_t::GYRO_FS_250); mS_MPU9250 = new mpu_t (mpu_t::ACC_FS_16G, mpu_t::GYRO_FS_250); mS_INEMO = new inemo_t (inemo_t::ACC_FS_16G, @@ -35,15 +37,16 @@ bool AnakinBoard::init() inemo_t::COMPASS_FS_2); mS_FXAS = new fxas_t (fxas_t::DPS500); mS_LPS331AP = new lps331ap_t (lps331ap_t::SS_25HZ); - mS_MAX21105 = new max21105_t (max21105_t::ACC_FS_16G, - max21105_t::GYRO_FS_250); mS_MS580 = new ms580_t(); + //The MAX21105 has to be initialized first as it is prone to listening + //to the initialization of the other sensors and switch by mistake to + //I2C mode + INIT_AND_CHECK(mS_MAX21105); INIT_AND_CHECK(mS_MPU9250); INIT_AND_CHECK(mS_INEMO); INIT_AND_CHECK(mS_FXAS); INIT_AND_CHECK(mS_LPS331AP); - INIT_AND_CHECK(mS_MAX21105); INIT_AND_CHECK(mS_MS580); AddSensor(MPU9250_ACCEL, DATA_VEC3, mS_MPU9250->accelDataPtr()); diff --git a/src/shared/sensors/MAX21105.h b/src/shared/sensors/MAX21105.h index e78b09469f969e28980ae86d0ae9e73c0e9ca2fa..fc74175831d271194e5165f64ab468ba52b9eddf 100644 --- a/src/shared/sensors/MAX21105.h +++ b/src/shared/sensors/MAX21105.h @@ -66,6 +66,7 @@ public: // Init this sensor uint8_t init_data[][2] = { + {MIF_CFG, 0b00101001}, // SPI 4 wire, I2C OFF (important!) {EXT_STATUS, 0x00}, // Choose the bank 0 {SET_PWR, 0x00}, // Power down