Hi. I hope this isn't a duplicate. I'm probably missing something obvious but I'm having a very hard time handling the FIFO mechanism on the MPU-9250.
I am communicating with the MPU-9250 with a Raspberry Pi Zero's I2C interface, using pure C++ code (no Python is involved). The I2C bus is presently running at 100 kHz.
I can successfully read and write all of the configuration registers, and I can successfully read the individual sensor output registers. A simple program which reads those individual registers shows output that tracks with the orientation of the device.
However, I cannot figure out how to get the FIFO or interrupt mechanism working.
- I can read FIFO_COUNTH/FIFO_COUNTL and see the value increase to the maximum of 512 and stay there
- Reading from FIFO_R_W returns strings of all the same byte, whether reading one byte at a time or 32 bytes in a single I2C transaction
- Reading form the FIFO_R_W register has no apparent effect on the next value retrieved from FIFO_COUNTH/FIFO_COUNTL
- The FIFO fills much faster than expected; with SMPLRTDIV == 200 and only ACCEL set in FIFO_ENABLE, the FIFO still fills in under a second (I was expecting only 30 (6 x (1 kHz/200)) bytes per second based on those configuration values)
- The INT_STATUS register never has FIFO_OFLOW_INT set (always reads as 0b00000000) even though FIFO_OVERFLOW_EN is set in INT_ENABLE
Is there any magic about when to set various configuration registers? Whether the MPU-9250 should be asleep or awake when setting configuration? Or some things that should be set first, then other things set later? What additional information should I provide to help solve this problem?
Thanks!