insert magnetometer data in FIFO

By gunter , 10 April 2014

Hi,

I use MPU9150.
I managed to get data from magnetometer when I request the magnetometer registers directly.
Now I would like to insert data from magnetometer in the FIFO.
I configure the registers from slave 0 like this:
i2cWriteByte(MPU6050_I2C_ADDRESS, MPU6050_USER_CTRL , 0b01000000);
i2cWriteByte(MPU6050_I2C_ADDRESS, MPU6050_INT_PIN_CFG, 0x02);
i2cWriteByte(MAG_I2C_ADDRESS, 0x0A, 0x01);
i2cWriteByte(MPU6050_I2C_ADDRESS, MPU6050_I2C_SLV0_ADDR, 0x80|MAG_I2C_ADDRESS)
i2cWriteByte(MPU6050_I2C_ADDRESS, MPU6050_I2C_SLV0_REG, MAG_DATA_REGISTER);
i2cWriteByte(MPU6050_I2C_ADDRESS, MPU6050_I2C_SLV0_CTRL, 0x86);
i2cWriteByte(MPU6050_I2C_ADDRESS,MPU6050_FIFO_EN,0b11111001);

and next I ask a measure every 100ms

When I read the FIFO, I get correct values for accelero and gyro but the value for magneto is always 0 on the three axis.
Does anyone know where is my mistake?

Best regards,

guy_mcilroy

11 years 8 months ago

FIFO is only configured to have values of accel and gyro; to read magnetometer values, special gyro registers or MPU bypass should be used.

phpbb Post ID
24858
phpbb Topic ID
16068