Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to reset all for a status = writeData(MPU6050_PWR_MGMT_1_REGISTER, 0x01) = 0 again #35

Open
philippedc opened this issue Oct 27, 2022 · 0 comments

Comments

@philippedc
Copy link

Hi, I use your library and I wanted to add the INT function.

This works:

#define MPU6050_ADDRESS   0x68 // Device address when ADO = 0
#define SIGNAL_PATH_RESET 0x68
#define ACCEL_CONFIG      0x1C
#define MOT_THR           0x1F  // Motion detection threshold bits [7:0]
#define MOT_DUR           0x20  // Duration counter threshold for motion interrupt generation, 1 kHz rate, LSB = 1 ms
#define MOT_DETECT_CTRL   0x69
#define WHO_AM_I_MPU6050  0x75  // Should return 0x68
#define INT_PIN_CFG       0x37
#define INT_ENABLE        0x38
#define INT_STATUS        0x3A

  writeByte(MPU6050_ADDRESS, 0x6B, 0x00);
  writeByte(MPU6050_ADDRESS, SIGNAL_PATH_RESET, 0x07); //Reset all internal signal paths in the MPU-6050 by writing 0x07 to register 0x68;
  writeByte(MPU6050_ADDRESS, ACCEL_CONFIG, 0x01); //Write register 28 (==0x1C) to set the Digital High Pass Filter, bits 3:0. For example set it to 0x01 for 5Hz. (These 3 bits are grey in the data sheet, but they are used! Leaving them 0 means the filter always outputs 0.)
  writeByte(MPU6050_ADDRESS, MOT_THR, 10); //Write the desired Motion threshold to register 0x1F (For example, write decimal 20).  
  writeByte(MPU6050_ADDRESS, MOT_DUR, 40); //Set motion detect duration to 1  ms; LSB is 1 ms @ 1 kHz rate  
  writeByte(MPU6050_ADDRESS, MOT_DETECT_CTRL, 0x15); //to register 0x69, write the motion detection decrement and a few other settings (for example write 0x15 to set both free-fall and motion decrements to 1 and accelerometer start-up delay to 5ms total by adding 1ms. )   
  writeByte(MPU6050_ADDRESS, INT_ENABLE, 0x40); //write register 0x38, bit 6 (0x40), to enable motion detection interrupt.     
  writeByte(MPU6050_ADDRESS, INT_PIN_CFG, 0x10); 

however, and I spent hours and hours to try to understand.... and tried all possible manipulations but not the right one....

Once I code the MPU with the above code, I cannot execute anymore the example GetAngle.ino, status returns error 2.

Have you got a suggestion to reset the MPU that still works on interruptions but cannot load another code to measure angles for instance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant