kriswiner / MPU9250

Arduino sketches for MPU9250 9DoF with AHRS sensor fusion
1.03k stars 472 forks source link

Reset FIFO and DMP #492

Open mark2b opened 11 months ago

mark2b commented 11 months ago

There is a line in the acc/gyr calibration function writeByte(MPU9250_ADDRESS, MPU9250_USER_CTRL, 0x0C); // Reset FIFO and DMP Why value is 0x0C and not 0x6? 0x0C = 0b1100 Bits 2 and 3 are high But according to documentation for USER_CTRL, bit 3 is Reserved

Screenshot 2023-11-12 at 9 43 38
kriswiner commented 11 months ago

Long story short, Invensense didn't expose DMP control register bits in their public MPU9250 documents. So bit 3 is DMP reset.

You can use 0x06, or try both and see what difference it makes (none on power-up initialization), or consult the Motion_Sense code to see how Invensense does this, or find a MPU9250 DMP application note to see how to use this register bit, etc.

On Sat, Nov 11, 2023 at 11:47 PM Mark Berner @.***> wrote:

There is a line in the acc/gyr calibration function writeByte(MPU9250_ADDRESS, MPU9250_USER_CTRL, 0x0C); // Reset FIFO and DMP Why value is 0x0C and not 0x6? 0x0C = 0b1100 Bits 2 and 3 are high But according to documentation for USER_CTRL, bit 3 is Reserved [image: Screenshot 2023-11-12 at 9 43 38] https://user-images.githubusercontent.com/539063/282285459-07d71ae7-e775-465f-91eb-c6ca9f561d98.png

— Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/492, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKQDPWGCHUKM5AMHTETYEB5H7AVCNFSM6AAAAAA7H2SFZ2VHI2DSMVQWIX3LMV43ASLTON2WKOZRHE4DSMRZGE2TSNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mark2b commented 11 months ago

Thanks for quick answer and great repository

I have another question about calibration

I'm porting this code to rust for Pico 10DOF IMU There is a code - writing accelerometer biases, for me it works when I comment out this code only

// Apparently this is not working for the acceleration biases in the MPU-9250 // Are we handling the temperature correction bit properly? // Push accelerometer biases to hardware registers writeByte(MPU9250_ADDRESS, XA_OFFSET_H, data[0]); writeByte(MPU9250_ADDRESS, XA_OFFSET_L, data[1]); writeByte(MPU9250_ADDRESS, YA_OFFSET_H, data[2]); writeByte(MPU9250_ADDRESS, YA_OFFSET_L, data[3]); writeByte(MPU9250_ADDRESS, ZA_OFFSET_H, data[4]); writeByte(MPU9250_ADDRESS, ZA_OFFSET_L, data[5]); Thanks

kriswiner commented 11 months ago

What is the question?

On Sun, Nov 12, 2023 at 10:38 AM Mark Berner @.***> wrote:

Thanks for quick answer and great repository

I have another question about calibration

I'm porting this code to rust for Pico 10DOF IMU There is a code - writing accelerometer biases, for me it works when I comment out this code only

// Apparently this is not working for the acceleration biases in the MPU-9250 // Are we handling the temperature correction bit properly? // Push accelerometer biases to hardware registers writeByte(MPU9250_ADDRESS, XA_OFFSET_H, data[0]); writeByte(MPU9250_ADDRESS, XA_OFFSET_L, data[1]); writeByte(MPU9250_ADDRESS, YA_OFFSET_H, data[2]); writeByte(MPU9250_ADDRESS, YA_OFFSET_L, data[3]); writeByte(MPU9250_ADDRESS, ZA_OFFSET_H, data[4]); writeByte(MPU9250_ADDRESS, ZA_OFFSET_L, data[5]);

— Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/492#issuecomment-1807206476, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKU5RMQGZZRLTI5HRILYEEJSFAVCNFSM6AAAAAA7H2SFZ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBXGIYDMNBXGY . You are receiving this because you commented.Message ID: @.***>

mark2b commented 11 months ago

Sorry, should I expect it works properly if I write accelerometer biases or on some boards it will not work. (on some ino files this code commented out) I'm new with IMU.

kriswiner commented 11 months ago

This technically works, that is, you should be able to write the accel biases to the appropriate registers, but I have found the results to be unsatisfactory since the LSB is serves double duty as some sort of indicator bit such that the biases can be slightly off. So I apply accel biases in the main loop. The gyro bias registers work fine.

On Sun, Nov 12, 2023 at 10:50 AM Mark Berner @.***> wrote:

Sorry, should I expect it works properly if I write accelerometer biases or on some boards it will not work. (on some ino files this code commented out) I'm new with IMU.

— Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/492#issuecomment-1807209099, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKR55CXZXJTTZCPHOC3YEEK6FAVCNFSM6AAAAAA7H2SFZ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBXGIYDSMBZHE . You are receiving this because you commented.Message ID: @.***>