1

I want to handle case when my MPU6050 is disconnected and reset. Unfortunately, after reinit MPU6050 shows pitch and roll values as 0 and stabilizes after ~1-2s with right values. I would like to hint DMP by writing last read values before reset. Is it any interface for it? Btw, no matter I configure LPF with value 5 or 188 - 'issue' still exists.

RemarkableBucket
  • 340
  • 4
  • 11

1 Answers1

0

Solution

Try logging the 16 bytes of memory beginning at D_0_192 (defined in inv_mpu_dmp_motion_driver.c of motion_driver_6.12).

unsigned short buf[16];
mpu_read_mem(D_0_192, 16, buf);
// your chosen method of logging this buffer

Mine looked like this shortly after mpu_set_dmp_state(1):

3fffdfeb 003eb3b6 000d2278 00002f3c

and like this after stabilizing for 15 seconds:

1e246556 386e559d 01b407b2 004d6ad9

If my MPU6050-using device starts upside-down, it takes about this long for the readings to stabilize.

After the readings have stabilized, record the value as a constant and write it back to the same location when DMP setup happens:

mpu_write_mem(D_0_192, 16, buf);

Method

I logged the contents of some of the DMP's mentioned but unreferenced/undocumented registers in inv_mpu_dmp_motion_driver.c figuring that they probably expose this part of DMP state somewhere. I did this after a call to mpu_set_dmp_state(1).

I found a number of values that change while the DMP is running. D_0_192, which I believe to be the internal state corresponding to attitude was identifiable by its sluggish relaxation time. I haven't taken the time to interpret the contents. I have only copied the buffer and observed the intended result -- that the contents of the DMP fifo begin at the recorded attitude.

Disclaimer

This is undocumented, potentially very wrong, and certainly brittle (untested on anything other than the DMP firmware blob included in motion_driver_6.12). Use at your own risk.

RemarkableBucket
  • 340
  • 4
  • 11