This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C123 读取mpu9250DMP初始化加载DMP固件失败

用的是硬件I2C读取9250数据 并用DMP输出欧拉角 IIC连续读的函数绝对正确 但连续写就不一定了 先放个连续写的函数

uint8_t MPU_Write_Len(uint8_t addr,uint8_t reg,uint8_t len,uint8_t *buf)
{
 I2CMasterSlaveAddrSet(I2C1_BASE,addr,false);
 I2CMasterDataPut(I2C1_BASE,reg);
 I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_BURST_SEND_START);
  while(I2CMasterBusy(I2C1_BASE));
 if(len==1)
 {
  I2CMasterDataPut(I2C1_BASE,*buf);
 I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
 while(I2CMasterBusy(I2C1_BASE));
 I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
 }
 else
 {
  while(len)
  {
   I2CMasterDataPut(I2C1_BASE,*buf);
   I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    while(I2CMasterBusy(I2C1_BASE));
   len--;
   buf++;
  }
  I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
  while(I2CMasterBusy(I2C1_BASE));
  }
 
 return 0;
}
然后是DMP初始化里面加载DMP固件失败 
for (ii = 0; ii < length; ii += this_write) {
        this_write = min(LOAD_CHUNK, length - ii);
        if (mpu_write_mem(ii, this_write, (unsigned char*)&firmware[ii]))
            return -1;
        if (mpu_read_mem(ii, this_write, cur))
            return -1;
        if (memcmp(firmware+ii, cur, this_write))
            return -2;
总是返回-2 不知道是不是连续写的问题
或者恳请大佬留下你们用DMP的例成 被这个东西折腾两个星期了 就是得不到欧拉角
之前试过用角速度和加速度解算姿态角 可解算出来的角总是在鬼畜 资料看了无数遍 代码移植了无数条 就是搞不出来啊