Jump to content
I2Cdevlib Forums

9150 library NOT WORKING


Recommended Posts

Hi.

I have a problem on my 9150 and arduino.

In the past I have made a code for 6050 (with ADO HIGH 0X69) and all was ok and great. I have used the 6050 library and 6050 motionapps 20 library, and, i repeat, all was fine and ok AND dmp WORK very nice.

Now, I have tried to use my 9150 (with ADO HIGH 0X69) with the libraru 9150 motion app 41 and all is a disaster...

I have downloaded the code for github, but the first thing that i have see is that the arduino IDE was in error to compile it.

To solve the problem, i have copied the 6050 motion app 41 and i have replaced the "6050" text with "9150" and now all is ok.

But this is  not the problem....

The problem is that the  9150_dmp9 is still not working (whitout any error now...)

After this, i have found a simple code to read the 9150 raw value of gyro, acc and magneto and ALL IS WORKING.

This step was to check the correct work of the sensor, and now I know is ok.

Now i have loaded 9150_dmp9 with motionapp41 "modified" and I have activate the debug of the library to know in whis lines are the errors.

Now i know yhe problem is in those lines:

 


            DEBUG_PRINTLN(F("Waiting for FIRO count >= 46..."));
            while ((fifoCount = getFIFOCount()) < 46);
            DEBUG_PRINTLN(F("Reading FIFO..."));
            getFIFOBytes(fifoBuffer, min(fifoCount, 128)); // safeguard only 128 bytes
            DEBUG_PRINTLN(F("Reading interrupt status..."));
            getIntStatus();

 

and if I try to "comment" with // I have the same error on the following lines...

I think the error is NOT in the previous lines, but in an another part of the code.....

remember that my 9150 is ADOhigh (0x69) and the magneto is (0x0C).

 

Please help me, and sorry for my bad language...

Link to comment
Share on other sites

  • 3 weeks later...

Good news.

I have resolved my problem.

The errors are in the Motionapps41 file, and are more of one.

In the first remember that my 9150 is ADO High, (0x69).

In the second remember that my magnetometer is at 0x0C address.

 

This the guideline:

 

  • I have changed all "DevAddr" in th file with the 0x69.
  • I have changed all 0X68 call (except in the memory bank declaration) with 0X69.

 

  • I have changed those lines(before the key was (0X0E)

 

    DEBUG_PRINTLN(F("Setting magnetometer mode to power-down..."));
    //mag -> setMode(0);
    I2Cdev::writeByte(0X0C, 0x0A, 0x00);

    DEBUG_PRINTLN(F("Setting magnetometer mode to fuse access..."));
    //mag -> setMode(0x0F);
    I2Cdev::writeByte(0X0C, 0x0A, 0x0F);

    DEBUG_PRINTLN(F("Reading mag magnetometer factory calibration..."));
    int8_t asax, asay, asaz;
    //mag -> getAdjustment(&asax, &asay, &asaz);
    I2Cdev::readBytes(0X0C, 0x10, 3, buffer);

 

  • I have changed this line (before the key was (0X0E)

 

          DEBUG_PRINTLN(F("Setting AK8975 to single measurement mode..."));
            //mag -> setMode(1);
            I2Cdev::writeByte(0X0C, 0x0A, 0x01);

 

  • I have changed those lines (before the key was (.X.E)

 

            // setup AK8975 (0X0C) as Slave 0 in read mode
            DEBUG_PRINTLN(F("Setting up AK8975 read slave 0..."));
            I2Cdev::writeByte(0X69, MPU9150_RA_I2C_SLV0_ADDR, 0x8C);
            I2Cdev::writeByte(0X69, MPU9150_RA_I2C_SLV0_REG,  0x01);
            I2Cdev::writeByte(0X69, MPU9150_RA_I2C_SLV0_CTRL, 0xDA);

            // setup AK8975 (0X0C) as Slave 2 in write mode
            DEBUG_PRINTLN(F("Setting up AK8975 write slave 2..."));
            I2Cdev::writeByte(0X69, MPU9150_RA_I2C_SLV2_ADDR, 0x0C);
            I2Cdev::writeByte(0X69, MPU9150_RA_I2C_SLV2_REG,  0x0A);
            I2Cdev::writeByte(0X69, MPU9150_RA_I2C_SLV2_CTRL, 0x81);
            I2Cdev::writeByte(0X69, MPU9150_RA_I2C_SLV2_DO,   0x01);

 

Now all is working and without error.

The only thing is that the MAGNETOMETER IS NOT CONSIDERATE IN THE DMP.

Please give me a suggestion......

Ale

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...