kriswiner / MPU9250

Arduino sketches for MPU9250 9DoF with AHRS sensor fusion
1.04k stars 471 forks source link

Cannot connect to MPU-9250. It returns 0x73 instead of 0x71 #47

Open Poley09 opened 8 years ago

Poley09 commented 8 years ago

So everytime i try to connect, it prints this message -

MPU9250 I AM 73 I should be 71 Could not connect to MPU9250: 0x73

I have completed i2c scans and received raw data from my sensor before so i'm not sure what i'm doing wrong. Thanks in advance

kriswiner commented 8 years ago

Change the check to 0x73 and see if the sensor data appears. It's likely you changed a register address or have some other typo there.

-----Original Message----- From: Poley09 [mailto:notifications@github.com] Sent: March 7, 2016 10:12 AM To: kriswiner/MPU-9250 Subject: [MPU-9250] Cannot connect to MPU-9250. It returns 0x73 instead of 0x71 (#47)

So everytime i try to connect, it prints this message -

MPU9250 I AM 73 I should be 71 Could not connect to MPU9250: 0x73

I have completed i2c scans and received raw data from my sensor before so i'm not sure what i'm doing wrong. Thanks in advance

Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47 . https://github.com/notifications/beacon/AGY1qknCKI7YEQekWKGRA3uH69f5888sks5 prGqNgaJpZM4HrByj.gif

Poley09 commented 8 years ago

it now displays

MPU9250 I AM 73 I should be 73 Could not connect to MPU9250: 0x73

Poley09 commented 8 years ago

https://github.com/Poley09/9250/tree/master/_9250_code

thats what im using, it should be the exact same without the display.

kriswiner commented 8 years ago

It checks that the byte read in the register is what is expected. Change the expected value to 0x73 not the display value.

-----Original Message----- From: Poley09 [mailto:notifications@github.com] Sent: March 7, 2016 10:37 AM To: kriswiner/MPU-9250 Cc: Kris Winer Subject: Re: [MPU-9250] Cannot connect to MPU-9250. It returns 0x73 instead of 0x71 (#47)

it now displays

MPU9250 I AM 73 I should be 73 Could not connect to MPU9250: 0x73

Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-193386458 . https://github.com/notifications/beacon/AGY1qioCCYnYeX8ddg5gK8c9N4vF09W7ks5 prHBLgaJpZM4HrByj.gif

kriswiner commented 8 years ago

// Read the WHO_AM_I register, this is a good test of communication

byte c = readByte(MPU9250_ADDRESS, WHO_AM_I_MPU9250); // Read WHO_AM_I register for MPU-9250

Serial.print("MPU9250 "); Serial.print("I AM "); Serial.print(c, HEX); Serial.print(" I should be "); Serial.println(0x73, HEX);

if (c == 0x71) // WHO_AM_I should always be 0x68

{

Serial.println("MPU9250 is online...");

Change this to 0x73; what MPU9250 module are you using?

-----Original Message----- From: Poley09 [mailto:notifications@github.com] Sent: March 7, 2016 10:44 AM To: kriswiner/MPU-9250 Cc: Kris Winer Subject: Re: [MPU-9250] Cannot connect to MPU-9250. It returns 0x73 instead of 0x71 (#47)

https://github.com/Poley09/9250/tree/master/_9250_code

thats what im using, it should be the exact same without the display.

Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-193388886 . https://github.com/notifications/beacon/AGY1qhZx1ae3FrYo0mxA9P4Dk0ER079gks5 prHIJgaJpZM4HrByj.gif

Poley09 commented 8 years ago

Yep, sorry I was being stupid and looking in the complete wrong part, it all works now thank you

Poley09 commented 8 years ago

I was wondering if you could help me with another problem. when perfectly still at rest, i get values around yaw = 128.5 pitch = 3.2 and roll = -1/1 how would i go about getting them to 0 on rest? and im wanting them to control pan/tilt servos with yaw and pitch. However the yaw doesnt seem to be changing when moving it in any direction not just the y axis. i dont know whether there is a mistake somewhere as my pitch and roll seem to be mixed up aswell. thanks

kriswiner commented 8 years ago

How did you calibrate your sensors?

-----Original Message----- From: Poley09 [mailto:notifications@github.com] Sent: March 7, 2016 3:08 PM To: kriswiner/MPU-9250 Cc: Kris Winer Subject: Re: [MPU-9250] Cannot connect to MPU-9250. It returns 0x73 instead of 0x71 (#47)

I was wondering if you could help me with another problem. when perfectly still at rest, i get values around yaw = 128.5 pitch = 3.2 and roll = -1/1 how would i go about getting them to 0 on rest? and im wanting them to control pan/tilt servos with yaw and pitch. However the yaw doesnt seem to be changing when moving it in any direction not just the y axis. i dont know whether there is a mistake somewhere as my pitch and roll seem to be mixed up aswell. thanks

Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-193496665 . https://github.com/notifications/beacon/AGY1qnESWBJ4sWGu-RDKwUuO2bPvLpOQks5 prK_UgaJpZM4HrByj.gif

kriswiner commented 8 years ago

You can PM me at onehorse@earthlink.net.

Take a look here:

https://github.com/kriswiner/MPU-6050/wiki/Simple-and-Effective-Magnetometer -Calibration

Kris

-----Original Message----- From: Poley09 [mailto:notifications@github.com] Sent: March 7, 2016 3:58 PM To: kriswiner/MPU-9250 Cc: Kris Winer Subject: Re: [MPU-9250] Cannot connect to MPU-9250. It returns 0x73 instead of 0x71 (#47)

not correctly im guessing, im not too experienced with these sensors. do you have an email address i could speak to you on? or send one to matthewpole@hotmail.co.uk and ill reply back to that? please and thank you.

Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-193513754 . https://github.com/notifications/beacon/AGY1ql7igXZVR7IMUusb_H-XgFAJdFM7ks5 prLttgaJpZM4HrByj.gif

whatnick commented 8 years ago

I am having a similar issue. I can communicate with the board. But I get 0xA0 as the who am i value. What can change this ?

kriswiner commented 8 years ago

There is something very wrong if you are not reading 0x71. Can you verify with an I2C scanner that you are getting an ACK from the MPU9250? You should see 3V3 on the SDA/SCL lines and finf I2C device 0x68 or 0x69 with an I2C scan. Can you read any of the data registers?

whatnick commented 8 years ago

Hi Kris,

Thanks for your response. I do get an Ack from 0x68. Which indicates something else is wrong with the chip or it is a counterfeit. I will try another from the batch then get more from a different sipplier. On 4 May 2016 2:43 am, "Kris Winer" notifications@github.com wrote:

There is something very wrong if you are not reading 0x71. Can you verify with an I2C scanner that you are getting an ACK from the MPU9250? You should see 3V3 on the SDA/SCL lines and finf I2C device 0x68 or 0x69 with an I2C scan.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-216599668

kriswiner commented 8 years ago

It could be a bad board but if you are getting an I2C ACK this is unlikely; it could still be that you have something wrong with the I2C read software, or you are not supplying the proper voltage to the chip. Can you check these things? Can you write to a control register and read it back to verify that you are able to write?

What do you get when you read the whoami register? 0xFF?

-----Original Message----- From: Tisham Dhar [mailto:notifications@github.com] Sent: May 3, 2016 4:19 PM To: kriswiner/MPU-9250 Cc: Kris Winer; Comment Subject: Re: [kriswiner/MPU-9250] Cannot connect to MPU-9250. It returns 0x73 instead of 0x71 (#47)

Hi Kris,

Thanks for your response. I do get an Ack from 0x68. Which indicates something else is wrong with the chip or it is a counterfeit. I will try another from the batch then get more from a different sipplier. On 4 May 2016 2:43 am, "Kris Winer" notifications@github.com wrote:

There is something very wrong if you are not reading 0x71. Can you verify with an I2C scanner that you are getting an ACK from the MPU9250? You should see 3V3 on the SDA/SCL lines and finf I2C device 0x68 or 0x69 with an I2C scan.

You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-216599668

You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-216693847 https://github.com/notifications/beacon/AGY1qui4JfwoafegUzLKTgQ-Hb2CkfU-ks5 p99fzgaJpZM4HrByj.gif

whatnick commented 8 years ago

I get 0xA0. I am using your MPU9250 demo code. Will check voltages. On 4 May 2016 10:10 am, "Kris Winer" notifications@github.com wrote:

It could be a bad board but if you are getting an I2C ACK this is unlikely; it could still be that you have something wrong with the I2C read software, or you are not supplying the proper voltage to the chip. Can you check these things? Can you write to a control register and read it back to verify that you are able to write?

What do you get when you read the whoami register? 0xFF?

-----Original Message----- From: Tisham Dhar [mailto:notifications@github.com] Sent: May 3, 2016 4:19 PM To: kriswiner/MPU-9250 Cc: Kris Winer; Comment Subject: Re: [kriswiner/MPU-9250] Cannot connect to MPU-9250. It returns 0x73 instead of 0x71 (#47)

Hi Kris,

Thanks for your response. I do get an Ack from 0x68. Which indicates something else is wrong with the chip or it is a counterfeit. I will try another from the batch then get more from a different sipplier. On 4 May 2016 2:43 am, "Kris Winer" notifications@github.com wrote:

There is something very wrong if you are not reading 0x71. Can you verify with an I2C scanner that you are getting an ACK from the MPU9250? You should see 3V3 on the SDA/SCL lines and finf I2C device 0x68 or 0x69 with an I2C scan.

You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-216599668

You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-216693847 < https://github.com/notifications/beacon/AGY1qui4JfwoafegUzLKTgQ-Hb2CkfU-ks5 p99fzgaJpZM4HrByj.gif>

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-216710529

kriswiner commented 8 years ago

I think you are reading the wrong register. Try reading some other registers, after you write to them

-----Original Message----- From: Tisham Dhar [mailto:notifications@github.com] Sent: May 3, 2016 10:44 PM To: kriswiner/MPU-9250 Cc: Kris Winer; Comment Subject: Re: [kriswiner/MPU-9250] Cannot connect to MPU-9250. It returns 0x73 instead of 0x71 (#47)

I get 0xA0. I am using your MPU9250 demo code. Will check voltages. On 4 May 2016 10:10 am, "Kris Winer" notifications@github.com wrote:

It could be a bad board but if you are getting an I2C ACK this is unlikely; it could still be that you have something wrong with the I2C read software, or you are not supplying the proper voltage to the chip. Can you check these things? Can you write to a control register and read it back to verify that you are able to write?

What do you get when you read the whoami register? 0xFF?

-----Original Message----- From: Tisham Dhar [mailto:notifications@github.com] Sent: May 3, 2016 4:19 PM To: kriswiner/MPU-9250 Cc: Kris Winer; Comment Subject: Re: [kriswiner/MPU-9250] Cannot connect to MPU-9250. It returns 0x73 instead of 0x71 (#47)

Hi Kris,

Thanks for your response. I do get an Ack from 0x68. Which indicates something else is wrong with the chip or it is a counterfeit. I will try another from the batch then get more from a different sipplier. On 4 May 2016 2:43 am, "Kris Winer" notifications@github.com wrote:

There is something very wrong if you are not reading 0x71. Can you verify with an I2C scanner that you are getting an ACK from the MPU9250? You should see 3V3 on the SDA/SCL lines and finf I2C device 0x68 or 0x69 with an I2C scan.

You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-216599668

You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-216693847 <

https://github.com/notifications/beacon/AGY1qui4JfwoafegUzLKTgQ-Hb2CkfU-ks5 p99fzgaJpZM4HrByj.gif>

You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-216710529

You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-216750376 https://github.com/notifications/beacon/AGY1qgp3Nxj9hjvCzWgrPPmKk9a-m3Yuks5 p-DI0gaJpZM4HrByj.gif

whatnick commented 8 years ago

Hi,

Which register will be good control register test case. This was my first QFN soldering attempt and there might be dry joints etc. I will continue testing. Thanks for the assistance.

kriswiner commented 8 years ago

Make sure you set Power1 to 0x00 and then 0x01 to wake from sleep and set the clock. You could try to write to the CONFIG register. Write 0x00, then read, then write 0x03, then read. You could easily have cold solder joints which prevent power from getting to the ASIC even if you are getting an I2C ACK. Verify your code with a known good sensor. Check your solder joints for contact with the QFN side pads.

YanJenHuang commented 8 years ago

Hi, I also read the 0x73 in my WhoAmI register. Is different MPU9250 sensor has unique value? Can I change this value myself?

kriswiner commented 8 years ago

The WHO_AM_I register is read only, you cannot change the MPU9250 value, but you can change the value you compare with in the sketch to 0x73.

-----Original Message----- From: YanJenHuang [mailto:notifications@github.com] Sent: May 26, 2016 12:00 AM To: kriswiner/MPU-9250 Cc: Kris Winer; Comment Subject: Re: [kriswiner/MPU-9250] Cannot connect to MPU-9250. It returns 0x73 instead of 0x71 (#47)

Hi, I also read the 0x73 in my WhoAmI register. Is different MPU9250 sensor has unique value? Can I change this value myself?

You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-221792909 https://github.com/notifications/beacon/AGY1qhiwuN8ycuGRxQkVTFmqu872-_Udks5 qFUTSgaJpZM4HrByj.gif

guyl44 commented 8 years ago

Hi, I've been getting a similar error - the WHO_AM_I register returns "0" when I set the AD0 to 0, and "0xFF" when I set AD0 to 1. Now, I ran the I2C scanner and the device is at 0x68 - meaning, AD0 should be 0, right? Anyway, no one else seems to have gotten "0" as the return value so I'm kinda stuck and would appreciate your help.

kriswiner commented 8 years ago

It sounds like there is a problem with your i2c read function or with integer types. Please tell me more about your set up, which MCU, which mpu9259 breakout and what does the i2c read code look like and maybe I can help.

Sent from my iPhone

On Jul 2, 2016, at 2:43 AM, Guy Lalkin notifications@github.com wrote:

Hi, I've been getting a similar error - the WHO_AM_I register returns "0" when I set the AD0 to 0, and "0xFF" when I set AD0 to 1. Now, I ran the I2C scanner and the device is at 0x68 - meaning, AD0 should be 0, right? Anyway, no one else seems to have gotten "0" as the return value so I'm kinda stuck and would appreciate your help.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

guyl44 commented 8 years ago

Thanks!

OK, so I'm using Teensy 3.2, and that Chinese purple breakout board everyone seems to have ( http://www.play-zone.ch/en/mpu-9250-accelerometer-gyro-kompass.html).

And regarding the I2C scan - it just says "device found at address 0x68". Seems to be recognized.

One thing I changed from the default code is the interrupt pin - I'm connecting it to pin 22 on my Teensy, so I changed the code accordingly, but I don't think that's the culprit, ha.

Thanks again.

On Sat, Jul 2, 2016 at 5:14 PM, Kris Winer notifications@github.com wrote:

It sounds like there is a problem with your i2c read function or with integer types. Please tell me more about your set up, which MCU, which mpu9259 breakout and what does the i2c read code look like and maybe I can help.

Sent from my iPhone

On Jul 2, 2016, at 2:43 AM, Guy Lalkin notifications@github.com wrote:

Hi, I've been getting a similar error - the WHO_AM_I register returns "0" when I set the AD0 to 0, and "0xFF" when I set AD0 to 1. Now, I ran the I2C scanner and the device is at 0x68 - meaning, AD0 should be 0, right? Anyway, no one else seems to have gotten "0" as the return value so I'm kinda stuck and would appreciate your help.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-230103753, or mute the thread https://github.com/notifications/unsubscribe/APmwYEwNega4GffYBtOC0vNmtVMaG-etks5qRnJLgaJpZM4HrByj .

kriswiner commented 8 years ago

Are you pulling NCS HIGH?

-----Original Message----- From: Guy Lalkin [mailto:notifications@github.com] Sent: July 2, 2016 7:50 AM To: kriswiner/MPU-9250 Cc: Kris Winer; Comment Subject: Re: [kriswiner/MPU-9250] Cannot connect to MPU-9250. It returns 0x73 instead of 0x71 (#47)

Thanks!

OK, so I'm using Teensy 3.2, and that Chinese purple breakout board everyone seems to have ( http://www.play-zone.ch/en/mpu-9250-accelerometer-gyro-kompass.html).

And regarding the I2C scan - it just says "device found at address 0x68". Seems to be recognized.

One thing I changed from the default code is the interrupt pin - I'm connecting it to pin 22 on my Teensy, so I changed the code accordingly, but I don't think that's the culprit, ha.

Thanks again.

On Sat, Jul 2, 2016 at 5:14 PM, Kris Winer notifications@github.com wrote:

It sounds like there is a problem with your i2c read function or with integer types. Please tell me more about your set up, which MCU, which mpu9259 breakout and what does the i2c read code look like and maybe I can help.

Sent from my iPhone

On Jul 2, 2016, at 2:43 AM, Guy Lalkin notifications@github.com wrote:

Hi, I've been getting a similar error - the WHO_AM_I register returns "0" when I set the AD0 to 0, and "0xFF" when I set AD0 to 1. Now, I ran the I2C scanner and the device is at 0x68 - meaning, AD0 should be 0, right? Anyway, no one else seems to have gotten "0" as the return value so I'm kinda stuck and would appreciate your help.

You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-230103753, or mute the thread

https://github.com/notifications/unsubscribe/APmwYEwNega4GffYBtOC0vNmtVMaG- etks5qRnJLgaJpZM4HrByj .

You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-230105413 , or mute the thread https://github.com/notifications/unsubscribe/AGY1quOgw91j7U84DHlVxv-oVuGzck sFks5qRnqcgaJpZM4HrByj . https://github.com/notifications/beacon/AGY1qiT6FfH11nPUbUCVwDtb6NI1M29nks5 qRnqcgaJpZM4HrByj.gif

guyl44 commented 8 years ago

It's not connected to anything, so I guess... not? Oops. My connections are VCC (3.3v), GND, SCL & SDA and then the INT pin. I haven't connected anything else because all of the codes I've seen only require these five.

kriswiner commented 8 years ago

You have to pull NCS HIGH to put the MPU into I2C mode. Try it. And read the data sheet.

-----Original Message----- From: Guy Lalkin [mailto:notifications@github.com] Sent: July 2, 2016 8:14 AM To: kriswiner/MPU-9250 Cc: Kris Winer; Comment Subject: Re: [kriswiner/MPU-9250] Cannot connect to MPU-9250. It returns 0x73 instead of 0x71 (#47)

It's not connected to anything, so I guess... not? Oops. My connections are VCC (3.3v), GND, SCL & SDA and then the INT pin. I haven't connected anything else because all of the codes I've seen only require these five.

You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-230106545 , or mute the thread https://github.com/notifications/unsubscribe/AGY1qlt6D9MqNwIEbq2h4cmSYjJe5K 4fks5qRoBNgaJpZM4HrByj . https://github.com/notifications/beacon/AGY1qqik1NlR5TQ9VgsUrZKI2pSxDHmtks5 qRoBNgaJpZM4HrByj.gif

guyl44 commented 8 years ago

Will do. Thanks a bunch for the help!

Flavelius commented 8 years ago

0x73 comes from the MPU9255 in case anyone else is wondering.

kriswiner commented 8 years ago

I have asked Invensense about this and they haven't replied. How do you know this, is it in the MPU9255 data sheet? I'll check...

-----Original Message----- From: Julien Heimann [mailto:notifications@github.com] Sent: August 22, 2016 11:05 AM To: kriswiner/MPU-9250 Cc: Kris Winer; Comment Subject: Re: [kriswiner/MPU-9250] Cannot connect to MPU-9250. It returns 0x73 instead of 0x71 (#47)

0x73 comes from the MPU9255 in case anyone else is wondering.

You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-241498251 , or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qsxyE7Ia_RhsCsHr2VW8F tkIAeAiks5qieTggaJpZM4HrByj . https://github.com/notifications/beacon/AGY1qmAnogxFtAGEa2VYdzIffIj1T0dmks5 qieTggaJpZM4HrByj.gif

Flavelius commented 8 years ago

i found it in the register map document (http://stanford.edu/class/ee267/misc/MPU-9255-Register-Map.pdf) after i ran into the same issue (and i actually purchased the 9255 without realizing it)

kriswiner commented 8 years ago

Thanks, I just read the register map. Apparently the MPU9250 I bought on aliexpress.com were MPU9255 too!

Kris

-----Original Message----- From: Julien Heimann [mailto:notifications@github.com] Sent: August 22, 2016 1:39 PM To: kriswiner/MPU-9250 Cc: Kris Winer; Comment Subject: Re: [kriswiner/MPU-9250] Cannot connect to MPU-9250. It returns 0x73 instead of 0x71 (#47)

i found it in the register map document (http://stanford.edu/class/ee267/misc/MPU-9255-Register-Map.pdf) after i ran into the same issue (and i actually purchased the 9255 without realizing it)

You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-241542597 , or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qi1q85fXwVh-g_rQ1ksaQ AsK6K65ks5qigjggaJpZM4HrByj . https://github.com/notifications/beacon/AGY1qr-uIRFRK7GT5zFX6DTAx6YHwZGAks5 qigjggaJpZM4HrByj.gif

seandepagnier commented 8 years ago

I have also 0x73 chip. Is there a difference in the registers? What is the difference?

kriswiner commented 8 years ago

MPU9255 has WHO_AM_I of 0x73, there is some extra capability in the ASIC that allows some additional gesture control but otherwise this chip is identical to the MPU9250.

-----Original Message----- From: seandepagnier [mailto:notifications@github.com] Sent: August 28, 2016 5:08 PM To: kriswiner/MPU-9250 Cc: Kris Winer; Comment Subject: Re: [kriswiner/MPU-9250] Cannot connect to MPU-9250. It returns 0x73 instead of 0x71 (#47)

I have also 0x73 chip. Is there a difference in the registers? What is the difference?

You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU-9250/issues/47#issuecomment-243008303 , or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qmioaWmjpP4qaLM-kR74C iGJGwqUks5qkiL0gaJpZM4HrByj . https://github.com/notifications/beacon/AGY1qqSO4wxFnhsIyFg7iagUZJuDSmdvks5 qkiL0gaJpZM4HrByj.gif

kriswiner commented 7 years ago

If you are able to get an ACK on I2C address 0x68 you should be able to read the WHO_AM_I address. Sounds like your I2C library isn't working then.

Start with a simple sketch to do an I2S scan and then read the WHO_AM_I register only. What do you get? If still 0x00, post the complete (very short) code here and we will take a look.

On Fri, May 26, 2017 at 2:28 AM, Ivan Budnikov notifications@github.com wrote:

Hello, Kris! I have same problem as guyl44 -- WHO_AM_I returning 0. I have GY-91 (pink one) and Arduino UNO R3. Connections: VCC - 5V Gnd - Gnd SCL - SCL SDA - SDA Tried to connect 3.3V-NCS -- with no effect. I2C scan finds 2 devices with addresses 0x68 and 0x76 Tried to launch with old library for MPU6050 -- all works (without magnetometer, obviously), WHO_AM_I returns 56. Do you have any ideas what's wrong? P.S.: SCL and SDA levels are ~4V

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/47#issuecomment-304236077, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qmTVIgTUR_L4nu0_vMOU8etUBebpks5r9psggaJpZM4HrByj .

ibudnikov commented 7 years ago

(Created new issue, I thought, it would be more comfortable)

include

//#include "MPU6050.h"

include "MPU9250.h"

//MPU6050 accelgyro; MPU9250 accelgyro; void setup() { Wire.begin(); byte c = accelgyro.getDeviceID(); Serial.begin(9600); Serial.println(c); Serial.println("\nI2C Scanner"); }

void loop() { byte error, address; int nDevices;

Serial.println("Scanning...");

nDevices = 0; for(address = 1; address < 127; address++ ) { // The i2c_scanner uses the return value of // the Write.endTransmisstion to see if // a device did acknowledge to the address. Wire.beginTransmission(address); error = Wire.endTransmission(); if (error == 0) { Serial.print("I2C device found at address 0x"); if (address<16) Serial.print("0"); Serial.print(address,HEX); Serial.println(" !"); nDevices++; } else if (error==4) { Serial.print("Unknow error at address 0x"); if (address<16) Serial.print("0"); Serial.println(address,HEX); }
} if (nDevices == 0) Serial.println("No I2C devices found\n"); else Serial.println("done\n"); delay(5000); // wait 5 seconds for next scan }

If I use MPU6050.h -- I get 2 addresses on scanner and WHO_AM_I register returns 56 If I use MPU9250.h (by Snowda) I get same 2 addresses, but WHO_AM_I responds 0. Some parts of code in library MPU9250:

define MPU9250_DEFAULT_ADDRESS 0xD1

define MPU9250_MAG_ADDRESS 0x0C

MPU9250::MPU9250() { _address = MPU9250_DEFAULT_ADDRESS; _mag_address = MPU9250_MAG_ADDRESS; } ... uint8_t MPU9250::getDeviceID(void) { _whoami = readRegister(MPU9250_WHO_AM_I); return _whoami; } ... uint8_t MPU9250::readRegister(const uint8_t register_addr) { //call sensor by address //call registers uint8_t data = 0;

Wire.beginTransmission(_address); 
Wire.write(register_addr); 
Wire.endTransmission(); 

Wire.requestFrom((int)_address, 1);

while(Wire.available()) {
    data = Wire.read();    // receive a byte as character
}
return data; //return the data returned from the register

}

kriswiner commented 7 years ago

Where is this defined?

MPU9250_WHO_AM_I

ibudnikov commented 7 years ago

define MPU9250_WHO_AM_I 0x75

0x75=117 -- correct register, I think.

kriswiner commented 7 years ago

Well, if you get an ACK on 0x68 and you are simply reading register 0x75 and getting zero return there are two possibilities:

1) your MPU9250 breakout is garbage

2) you I2C read code is flawed.

ibudnikov commented 7 years ago

But it works with MPU6050 library:

define MPU6050_ADDRESS_AD0_LOW 0x68 // address pin low (GND), default for InvenSense evaluation board

define MPU6050_ADDRESS_AD0_HIGH 0x69 // address pin high (VCC)

define MPU6050_DEFAULT_ADDRESS MPU6050_ADDRESS_AD0_LOW

define MPU6050_RA_WHO_AM_I 0x75

define MPU6050_WHO_AM_I_BIT 6

define MPU6050_WHO_AM_I_LENGTH 6

MPU6050::MPU6050() { devAddr = MPU6050_DEFAULT_ADDRESS; } uint8_t MPU6050::getDeviceID() { I2Cdev::readBits(devAddr, MPU6050_RA_WHO_AM_I, MPU6050_WHO_AM_I_BIT, MPU6050_WHO_AM_I_LENGTH, buffer); return buffer[0]; } int8_t I2Cdev::readBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t *data, uint16_t timeout) { // 01101001 read byte // 76543210 bit numbers // xxx args: bitStart=4, length=3 // 010 masked // -> 010 shifted uint8_t count, b; //Serial.println(" In readBits "); if ((count = readByte(devAddr, regAddr, &b, timeout)) != 0) { //Serial.print("Byte read successful: "); uint8_t mask = ((1 << length) - 1) << (bitStart - length + 1); b &= mask; b >>= (bitStart - length + 1); //Serial.println(b); *data = b; } else { //Serial.println("Byte read failed"); } return count; } It returns 56. Raw measurments from accels&gyros also makes sense -- but I can't read mag values due to hardware difference.

kriswiner commented 7 years ago

There is something wrong with your I2C implementation then

On Sat, May 27, 2017 at 1:04 PM, Ivan Budnikov notifications@github.com wrote:

But it works with MPU6050 library:

define MPU6050_ADDRESS_AD0_LOW 0x68 // address pin low (GND), default for

InvenSense evaluation board #define MPU6050_ADDRESS_AD0_HIGH 0x69 // address pin high (VCC) #define MPU6050_DEFAULT_ADDRESS MPU6050_ADDRESS_AD0_LOW #define MPU6050_RA_WHO_AM_I 0x75 #define MPU6050_WHO_AM_I_BIT 6 #define MPU6050_WHO_AM_I_LENGTH 6 MPU6050::MPU6050() { devAddr = MPU6050_DEFAULT_ADDRESS; } uint8_t MPU6050::getDeviceID() { I2Cdev::readBits(devAddr, MPU6050_RA_WHO_AM_I, MPU6050_WHO_AM_I_BIT, MPU6050_WHO_AM_I_LENGTH, buffer); return buffer[0]; } It returns 56. Raw measurments from accels&gyros also makes sense -- but I can't read mag values due to hardware difference.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/47#issuecomment-304473612, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qjDzIGg6Xv_2xApZVDzugMa8eFckks5r-IGxgaJpZM4HrByj .

ibudnikov commented 7 years ago

You were right. I've changed underlying Wire.h library to I2Cdev, made necessary changes to my code, and everything is working now. If there is anyone with same problem -- I can share my code.

ibudnikov commented 7 years ago

One more question -- this time about your code:) Lines 407-409: magbias[0] = +470.; // User environmental x-axis correction in milliGauss magbias[1] = +120.; // User environmental y-axis correction in milliGauss magbias[2] = +125.; // User environmental z-axis correction in milliGauss Why this numbers? It's not related to magnetic inclination and declination, if I understand correctly.

kriswiner commented 7 years ago

These are for my specific MPU9250. You have to calibrate your own.

On Mon, May 29, 2017 at 12:58 PM, Ivan Budnikov notifications@github.com wrote:

One more question -- this time about your code:) Lines 407-409: magbias[0] = +470.; // User environmental x-axis correction in milliGauss magbias[1] = +120.; // User environmental y-axis correction in milliGauss magbias[2] = +125.; // User environmental z-axis correction in milliGauss Why this numbers? It's not related to magnetic inclination and declination, if I understand correctly.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/47#issuecomment-304722897, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qrffJqUORikcgsg-mM9TKStL-fk2ks5r-yNrgaJpZM4HrByj .

ibudnikov commented 7 years ago

Ok, thanks.

GerardSD commented 6 years ago

Kriswiner i need you help! I am programming the mpu9250 with the mpu432 in CodeComposer. At the moment I just want to be able to read the WHO-I-AM register. Do you have an example to help me? Thanks

kriswiner commented 6 years ago

There are plenty in the repository...

On Wed, Apr 4, 2018 at 3:53 AM, GerardSD notifications@github.com wrote:

Kriswiner i need you help! I am programming the mpu9250 with the mpu432 in CodeComposer. At the moment I just want to be able to read the WHO-I-AM register. Do you have an example to help me? Thanks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/47#issuecomment-378560071, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qgr8JwvaBKrggyITodsPZatulFgwks5tlKYagaJpZM4HrByj .

carbonadam commented 6 years ago

IS your code going to work on with the MPU9255 or are there other problems I might run into. Ive had some of the code running but the Yaw values are inconstant, for example seem to want to return to around 90.

kriswiner commented 6 years ago

Should work on MPU9255. Did you calibrate the sensors? Are you feeding the sensor data into the Madgwick filter in NED order?

On Wed, Jul 25, 2018 at 6:53 AM, Adam notifications@github.com wrote:

IS your code going to work on with the MPU9255 or are there other problems I might run into. Ive had some of the code running but the Yaw values are inconstant, for example seem to want to return to around 90.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/47#issuecomment-407761777, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1quLtGqYAm17uMngpwtJR9VD8ZeGPks5uKHhLgaJpZM4HrByj .

kriswiner commented 5 years ago

Your I2C is either not connected properly or it is not working properly.

On Fri, Jun 14, 2019 at 7:28 AM amod8 notifications@github.com wrote:

If anyone could help me resolve this error.

inv-mpu6050-i2c 1-0068: invalid whoami 0x40 expected 0x71 (MPU9250)

I am stuck since 3 days. Please follow this stackoverflow link for the complete question:

https://stackoverflow.com/questions/56578146/how-to-fix-mpu9250-configuration-issue-in-device-tree http://url

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/47?email_source=notifications&email_token=ABTDLKWGK4D35XR2NA3QKHTP2OTIXA5CNFSM4B5MDSR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXW6REY#issuecomment-502130835, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTDLKRJDF65D7ZMXOUEGZDP2OTIXANCNFSM4B5MDSRQ .

kriswiner commented 5 years ago

OK, when you do an I2C scan, which devices show up? Is it possible the other device also have I2C address 0c68?

On Fri, Jun 14, 2019 at 7:34 AM amod8 notifications@github.com wrote:

I have already configured pressure sensor and I/O expander with I2c. Also I will share my schematics [image: Sch] https://user-images.githubusercontent.com/43169605/59516743-4e4d5000-8ec2-11e9-9274-21a41954bf9e.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/47?email_source=notifications&email_token=ABTDLKTE2XM6AVE42S2RMZDP2OUAJA5CNFSM4B5MDSR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXW7DBA#issuecomment-502133124, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTDLKTZ3SLZYHBXQ2ELAILP2OUAJANCNFSM4B5MDSRQ .

kriswiner commented 5 years ago

And did you try it with a different MPU9250 breakout board?

On Fri, Jun 14, 2019 at 7:41 AM amod8 notifications@github.com wrote:

I2c scan shows this , I have already configured other devices connected to i2c, only this imu is showing above mentioned error.

0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- UU UU UU -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 70: -- -- -- -- -- -- 76 --

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/47?email_source=notifications&email_token=ABTDLKXK337IPHPZSPVPKITP2OU3DA5CNFSM4B5MDSR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXW7YDQ#issuecomment-502135822, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTDLKS2KYYYFCS2XFZLNRDP2OU3DANCNFSM4B5MDSRQ .