jrowberg / i2cdevlib

I2C device library collection for AVR/Arduino or other C++-based MCUs
http://www.i2cdevlib.com
3.94k stars 7.51k forks source link

MPU6050_6Axis_MotionApps20.h - where is 0x01 on line 261? #85

Closed ILANE1 closed 3 years ago

ILANE1 commented 10 years ago

Hi! Coding-wise, I am not there yet, but I've read about "change the output rate of the DMP to something slower than 100Hz, by modifying the last byte on line 261.....The default value is 0x01, but setting it to 0x07 will give you a 25Hz rate". Looking at the file dated 5/20/2013, and fail repeatedly to locate any 0x01 in the vicinity. Perhaps you could point to the significant byte by specifying bank # (is it in bank 7?) and its ordinal number in said bank. Or let me know what is it that am I totally misunderstanding about this. Many thanks. As a side bonus, perhaps you can point to a good place to read about optimizing the output rate of the DMP to my application (yet another home brewed Segway clone, done by sexagenarians).

pagalFromAgra commented 10 years ago

Hello ILANE1,

Check the dmpConfig after bank 7 in MPU6050_6Axis_MotionApps20.h. See the piece of code below.

0x00,   0x00,   0x00,   0x01, // SET INT_ENABLE at i=22, SPECIAL INSTRUCTION
0x07,   0x86,   0x01,   0xFE,                     // CFG_6 inv_set_fifo_interupt
0x07,   0x41,   0x05,   0xF1, 0x20, 0x28, 0x30, 0x38, // CFG_8 inv_send_quaternion
0x07,   0x7E,   0x01,   0x30,                     // CFG_16 inv_set_footer
0x07,   0x46,   0x01,   0x9A,                     // CFG_GYRO_SOURCE inv_send_gyro
0x07,   0x47,   0x04,   0xF1, 0x28, 0x30, 0x38,   // CFG_9 inv_send_gyro -> inv_construct3_fifo
0x07,   0x6C,   0x04,   0xF1, 0x28, 0x30, 0x38,   // CFG_12 inv_send_accel -> inv_construct3_fifo

// 0x02, 0x16, 0x02, 0x00, 0x01 // D_0_22 inv_set_fifo_rate to 100Hz 0x02, 0x16, 0x02, 0x00, 0x03 // D_0_22 inv_set_fifo_rate to 50Hz

// This very last 0x01 WAS a 0x09, which drops the FIFO rate down to 20 Hz. 0x07 is 25 Hz,
// 0x01 is 100Hz. Going faster than 100Hz (0x00=200Hz) tends to result in very noisy data.
// DMP output frequency is calculated easily using this equation: (200Hz / (1 + value))

// It is important to make sure the host processor can keep up with reading and processing
// the FIFO output at the desired rate. Handling FIFO overflow cleanly is also a good idea.

Best,

ILANE1 commented 10 years ago

Thank you! Got it. When I open the h file inside the Arduino IDE 1.5.6-r2, the relevant line is 305. Is this an indication of a problem?

Please bear with me in the future - I do understand explanation and answers, but I may ask newbie questions. Cheers!

On Mon, Sep 8, 2014 at 5:45 PM, pagalFromAgra notifications@github.com wrote:

Hello ILANE1,

Check the dmpConfig after bank 7 in MPU6050_6Axis_MotionApps20.h. See the piece of code below.

0x00, 0x00, 0x00, 0x01, // SET INT_ENABLE at i=22, SPECIAL INSTRUCTION 0x07, 0x86, 0x01, 0xFE, // CFG_6 inv_set_fifo_interupt 0x07, 0x41, 0x05, 0xF1, 0x20, 0x28, 0x30, 0x38, // CFG_8 inv_send_quaternion 0x07, 0x7E, 0x01, 0x30, // CFG_16 inv_set_footer 0x07, 0x46, 0x01, 0x9A, // CFG_GYRO_SOURCE inv_send_gyro 0x07, 0x47, 0x04, 0xF1, 0x28, 0x30, 0x38, // CFG_9 inv_send_gyro -> inv_construct3_fifo 0x07, 0x6C, 0x04, 0xF1, 0x28, 0x30, 0x38, // CFG_12 inv_send_accel -> inv_construct3_fifo

// 0x02, 0x16, 0x02, 0x00, 0x01 // D_0_22 inv_set_fifo_rate to 100Hz 0x02, 0x16, 0x02, 0x00, 0x03 // D_0_22 inv_set_fifo_rate to 50Hz

// This very last 0x01 WAS a 0x09, which drops the FIFO rate down to 20 Hz. 0x07 is 25 Hz, // 0x01 is 100Hz. Going faster than 100Hz (0x00=200Hz) tends to result in very noisy data. // DMP output frequency is calculated easily using this equation: (200Hz / (1 + value))

// It is important to make sure the host processor can keep up with reading and processing // the FIFO output at the desired rate. Handling FIFO overflow cleanly is also a good idea.

Best,

  • Aditya

— Reply to this email directly or view it on GitHub https://github.com/jrowberg/i2cdevlib/issues/85#issuecomment-54830108.

Your friend Ilan

jrowberg commented 3 years ago

Closing ancient issue for cleanup.