I have my MPU-6050 working fine using the code from the arduino playground from Krodol, but I can't get the FIFO enabled and working. Does anyone have some example code they could share?
The FIFO appears to work fine when I use the DMP example, but that seems to be just a black box. I want to measure the z-axis of the gyro directly. This works using Krodol's example code, and I can read and write to the configuration registers. I can get readings directly from the sensor registers, but when I read from FIFO I get nothing. Also the FIFO counter reports 0 (I read it in the proper order, COUNTH, then COUNTL). I have scoured the register map for any setting that my affect the FIFO. I have set the proper bits in the FIFO_EN, and USER_CTRL registers. I have set the clock source to internal 8kHz as well as various gyro PLL clocks. I still see no sign of data on the FIFO. Can anyone shed some light? Thanks!
That code works fine with both DMP and RAW. It's not obvious in the code, though, how to get FIFO working. In the DMP example, the FIFO works, but the code is full of unknown functions and large blocks of byte codes that make it almost impossible to decipher. Because it's almost a black box, it's impossible to customize for my application.
I want to use the RAW mode, which is easier to follow and configure, but it doesn't use the FIFO buffer. What I want is a clear example of working code that uses the FIFO, but not in DMP mode.
I have the following problem. Are built on a breadboard.
Arduino MEAG 2560
MPU6050 on 5V
SDA and SCL 4,7k Pullup to 3.3V
INT connect to PIN 2
ADO to GND
Bauderate 19200 or 115000
BMP085 → 5V
HMC5883L → 3.3V I2C Not connected to MPU6050
All voltages from the Arduino.
MPU6050 example Raw and DMP.
The values ypr are usually OK. Meanwhile, a FIFO overflow is reported. I have checked the contacts on the breadboard. They’re OK, I guess.
while (!mpuInterrupt && fifoCount < packetSize)
// other program behavior stuff here
Test =+1; ← This statement is not executed.
I’ve been trying for a very long time to find the error, would be grateful for any help. I will write this in the German forum too.
@NATO, I have been struggling with a similar problem and as you mentioned that you started with Krodol's code, you may have run into the same issue.
I also started with Krodol's code and the symptoms were the same as yours. This code, however, works:
I spent countless hours to figure out, why the code based on Krodol's code does not work and at the end, the solution was ridiculously trivial. Krodol reuses the MPU6050_FIFO_EN macro, first as a register:
#define MPU6050_FIFO_EN 0x23 // R/W
and then as a bit:
#define MPU6050_FIFO_EN MPU6050_D6
This means that if you innocently try to modify Krodol's code to handle the FIFO, the key FIFO_EN register's address will be incorrect. The error is very hard to notice as the first definition is correct.