Firstly detect the ID. I can get the expected (Gyro ID 0xf, and Acc ID: 0xfa) I2CCoreReadEx(etIsaImuGyro, I2C_IMU_BMI_ID_REG,
&u8, sizeof(u8), DA_SingleByte, DA_SingleByte, 0, 0, 0)) /* Gyro Chip Id: 0x0f */
I2CCoreReadEx(etIsaImuGyro, I2C_IMU_BMI_ID_REG,
&u8, sizeof(u8), DA_SingleByte, DA_SingleByte, 0, 0, 0)) /* Accel chip Id: 0xfa */
Then apply bellow init sequence: SoftReset, Configure: static imuBMIi2cData s_BMI_SoftReset[] = {
IMU_BMI_I2C_DATA_INIT(etIsaImuAcc, I2C_IMU_BMI_SOFTRESET, BMI_SOFTRESET)
IMU_BMI_I2C_DATA_INIT(etIsaImuGyro, I2C_IMU_BMI_SOFTRESET, BMI_SOFTRESET)
};
static imuBMIi2cData s_BMI_Gyro_cfg[] = {
IMU_BMI_I2C_DATA_INIT(etIsaImuGyro, I2C_IMU_BMI_WDT, BMI_WDT_EN | BMI_WDT_50MS)
IMU_BMI_I2C_DATA_INIT(etIsaImuGyro, I2C_GYRO_INT_MAP_1_REG, I2C_GYRO_MAP_INT1_DATA)
IMU_BMI_I2C_DATA_INIT(etIsaImuGyro, I2C_GYRO_INT_EN_1_REG, I2C_GYRO_INT1_LVL)
IMU_BMI_I2C_DATA_INIT(etIsaImuGyro, I2C_GYRO_INT_EN_0_REG, I2C_GYRO_INT_DATA_EN)
IMU_BMI_I2C_DATA_INIT(etIsaImuGyro, I2C_IMU_PMU_RANGE_REG, I2C_GYRO_RANGE_1000)
// NL, keep BMI_SUSPEND last
IMU_BMI_I2C_DATA_INIT(etIsaImuGyro, I2C_IMU_BMI_LP_REG, BMI_SUSPEND)
};
static imuBMIi2cData s_BMI_Acc055_cfg[] = {
IMU_BMI_I2C_DATA_INIT(etIsaImuAcc, I2C_IMU_BMI_WDT, BMI_WDT_EN | BMI_WDT_50MS)
IMU_BMI_I2C_DATA_INIT(etIsaImuAcc, I2C_ACC_INT_MAP_1_REG, I2C_ACC_MAP_INT1_DATA)
IMU_BMI_I2C_DATA_INIT(etIsaImuAcc, I2C_ACC_INT_EN_1_REG, I2C_ACC_INT_DATA_EN)
IMU_BMI_I2C_DATA_INIT(etIsaImuAcc, I2C_IMU_PMU_RANGE_REG, I2C_ACC_PMU_RANGE_4G)
// NL, keep BMI_SUSPEND last
IMU_BMI_I2C_DATA_INIT(etIsaImuAcc, I2C_IMU_BMI_LP_REG, BMI_SUSPEND)
}; Then continouly poll gyro and accel : firstly pull gyro, then accel, then gryo, then accel...... /* From DateReg(0x2) read 6 bytes (I2C_IMU_DATA_SIZE) */
ret = I2CCoreReadEx(s_SensorI2CAddr[dev], s_I2CBMIRegs[dev][eDataReg],
pBuffer->IMU_data, I2C_IMU_DATA_SIZE, DA_SingleByte, DA_SingleByte, 100, 0, 10); The Accel data looks reasonable, and each sample with slight change. But Gyro data each sample change siginificantly
... View more