I have enabled data ready interrupt bit and also enabled the fifo bit and also enabled gyro_fifo and accel_fifo bits in mpu6050 so that when data ready interrupt occurs the gyro and accel data values get in fifo buffer.But on each interrupt the fifo count value increases by 24 but ideally it should increment by 12 (because 6 bytes for accel values and 6 bytes for gyro values). Please help me to solve the problem I am stuck in this for a couple of days. I am providing the code which I used to code this problem :
(writeByte(address,value) function write corresponding value to the given address).
// sample div register writeByte(0x19,0xff); // dlpf config writeByte(0x1A,0x01); // gyro config writeByte(0x1B,0x18); // Reset fifo enable bits writeByte(0x23,0x00); // pin_config_reg writeByte(0x37,0x00); //Gpio Settings gpio_init(); //Gyro,Accel Fifo Enable bits writeByte(0x23,0x78); // power enable sleep disabled writeByte(0x6B,0x00); writeByte(0x6B,0x00); // disable fifo writeBit(0x6A,0x06,0);
// user control- Fifo Enable writeBit(0x6A,0x06,1);
//Data Ready Interrupt enable writeByte(0x38,0x01);
readBurst(0x72,array,2); (readburst will read 0x72(FIFO_Count_H) and 0x73(FIFO_Count_L) and store in the array)
Please help me with something. Any help will be highly appreciated.