Better IMU6050 initialization

Post Reply
sorenkuula
Posts: 13
Joined: Mon Sep 30, 2013 2:17 pm

Better IMU6050 initialization

Post by sorenkuula »

Hi, I have been fighting with one problem for a day: On my home made HW, often the gyro would just remain stuck at 0,0,0 after startup. No among of resetting could unstick it. Just when I was about to toss it out, it worked again. And just as I got confident that my messing around with pull-ups etc had an effect, it stopped working again. Usual dev. story.

Anyway I found out why and I want to suggest the solution be incorporated in the release. It was the IMU6050 not getting initialised properly.
As mentioned on Page41 of the Register Map, the device should be reset by 2 register writes and with 100ms delays.
This leads to:

Code: Select all

void Gyro_init() {
  ...
  i2c_writeReg(MPU6050_ADDRESS, 0x6B, 0x80);             //PWR_MGMT_1    -- DEVICE_RESET 1
  delay(5);


being changed to:

Code: Select all

void Gyro_init() {
  ...
  i2c_writeReg(MPU6050_ADDRESS, 0x6B, 0x80);             //PWR_MGMT_1    -- DEVICE_RESET 1
  delay(100);
  i2c_writeReg(MPU6050_ADDRESS, 0x68, 0x7);              //SIGNAL_PATH_RESET    -- RESETS
  delay(100);


Ater I did that, I had reliable IMU startup every time.

Regards
Soren

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: Better IMU6050 initialization

Post by Alexinparis »

Hi,

The spec mentions the SIGNAL_PATH_RESET is specific for SPI. (so not I2C I think)

sorenkuula
Posts: 13
Joined: Mon Sep 30, 2013 2:17 pm

Re: Better IMU6050 initialization

Post by sorenkuula »

Bi, where do you find that? I don't see it neither in the PS nor the RM.
Anyway- it unjams my MPU6050 :)
Regards, Soren

brm
Posts: 287
Joined: Mon Jun 25, 2012 12:00 pm

Re: Better IMU6050 initialization

Post by brm »

Alexinparis wrote:Hi,

The spec mentions the SIGNAL_PATH_RESET is specific for SPI. (so not I2C I think)

???
nothing says it is for the spi variant only.
worth giving it a try.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: Better IMU6050 initialization

Post by Alexinparis »

spec page 41:

When using SPI interface, user should use DEVICE_RESET (register 107) as well as
SIGNAL_PATH_RESET (register 104) to ensure the reset is performed properly.

brm
Posts: 287
Joined: Mon Jun 25, 2012 12:00 pm

Re: Better IMU6050 initialization

Post by brm »

Alexinparis wrote:spec page 41:

When using SPI interface, user should use DEVICE_RESET (register 107) as well as
SIGNAL_PATH_RESET (register 104) to ensure the reset is performed properly.


my doc does not mention spi or i2c Interface when it Comes to resetting the Signal path.
the very next chapter mentions a a difference for the Interfaces.

Post Reply