-
Notifications
You must be signed in to change notification settings - Fork 908
Update on reset of mpu6050_i2c.c #319
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
Conversation
To reset the MPU6050, the device_reset bit shall be set to '1'. reference from "MPU-6000/MPU-6050 Register Map and Descriptions" DEVICE_RESET : When set to 1, this bit resets all internal registers to their default values. The bit automatically clears to 0 once the reset is done.
Did you test this change? |
I made a test using this code :
res will be used to rest the MPU then wait 200 ms then put the reset bit again to zero. if the reset bit was not set back to zero the MPU will not work. The above solution is tested and verfied. |
tsk; see #352 ... I assumed you tested your change and it worked, but what you say in the above comment is not the code in the commit. can you please clarify, and submit a new PR |
and explain what happens if |
Hi, just wanted to add an explanation to this solution. 0x80 is the correct value that should be written to the PWR_MGMT_1 (0x6B) register to cause a reset of all internal registers of the MPU6050 to their default values. Also if you really care about timing, you could reduce the delays quite a bit, I've found even a 1ms after reset is enough. I suppose this doesn't matter much for most applications but just wanted to mention it. Below is my slightly modified version of the code:
|
Hi @kilograham, I can confirm the explanation of @vexown. See MPU-6050 datasheet below. The example code in the current version results in the device only transmitting 0x00 for each acceleration, gyro and the temperature value because it's going right to SLEEP state. Actually, just writing 0x00 to register 0x6b results in a minimal working example because the device goes to SLEEP state on power-up as the default. However, the naming "mpu6050_reset()" does not really fit in this case. Something like "mpu6050_wakeup()" would match the actual effect.
BR, |
The reset process requires to set DEVICE_RESET bit in PWR_MGMT_1 (0x6B) bits to one ===> 0x80. then the we must release the reset bit or the device will remain always in reset mode. detailed explanation is here: raspberrypi#319
The reset process requires to set DEVICE_RESET bit in PWR_MGMT_1 (0x6B) bits to one ===> 0x80. then the we must release the reset bit or the device will remain always in reset mode. detailed explanation is here: raspberrypi#319
The reset process requires to set DEVICE_RESET bit in PWR_MGMT_1 (0x6B) bits to one ===> 0x80. then the we must release the reset bit or the device will remain always in reset mode. detailed explanation is here: raspberrypi#319
It is not merged yet I guess? Problem is still occuring |
i can confirm that 0x80 wont work, and 0x00 works! |
Did you try this code??? https://github.com/akhodeir/pico-examples/pull/1/files |
To reset the MPU6050, the device_reset bit shall be set to '1'.
reference from "MPU-6000/MPU-6050 Register Map and Descriptions"
DEVICE_RESET : When set to 1, this bit resets all internal registers to their default values. The bit automatically clears to 0 once the reset is done.