SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By Slaghton
#193949
Hi, I recently bought the Sparkfun MPU-9250 and hooked it up to my arduino mega but I think im doing something wrong. Loading up the MPU9250BasicAHRS_I2C example script and uploading I get this in the serial monitor.
Code: Select all
MPU9250 I AM 0x71 I should be 0x71
MPU9250 is online...
BHW::ii = 0
BHW::ii = 1
BHW::ii = 2

//This repeats till 199, saving thread space.

BHW::ii = 199
x-axis self test: acceleration trim within : 2.7% of factory value
y-axis self test: acceleration trim within : -0.6% of factory value
z-axis self test: acceleration trim within : 2.0% of factory value
x-axis self test: gyration trim within : -4.7% of factory value
y-axis self test: gyration trim within : -1.0% of factory value
z-axis self test: gyration trim within : 0.9% of factory value
MPU9250 initialized for active data mode....
AK8963 I AM 0xFF I should be 0x48
Communication failed, abort!
I'm new to this but I was hoping there was a working example to learn and build myself up from. Can anyone share a tip on what I should do?
By Slaghton
#193956
(Didn't see ability to edit my main post)
I want to say I got it working and it seems to be reading all the axis correctly by making the change belo.

I just commented out this block of code
Code: Select all
    //    if (d != 0x48)
    //    {
    //      // Communication failed, stop here
    //      Serial.println(F("Communication failed, abort!"));
    //      Serial.flush();
    //      abort();
    //    }
Though, I wonder if i just bypassed something and temporarily fixed the problem. I believe what its trying to do here is communicate with the magnetometer but I seem to get readings from it with this fix so idk.
By Slaghton
#193991
Ah, thanks for the info. There is two sketches I can use (I2C and SPI) and i'm using the I2C. I believe the SPI was giving me more problems so that makes sense. I'll have to look into this more later. For now, it seems I can get correct axis readings on all axis so i'll just leave it be till i'm hooking the chip up to my robot. Will probably learn more later as I progress.
By rony albert
#193997
In my case it ends up with configuration. I have checked everything twice but still facing same issue please help me how can i tackle it down. Prompt response would be much appreciated!