SparkFun will be closed Nov 26th and 27th for the Thanksgiving holiday. Orders placed after 2:00pm MT on the 25th will ship out Monday the 30th.

Member #428576

Member Since: April 12, 2013

Country: United States

  • Hi guys, Recently I buy the MPU9150 boards and want to get raw data from the on-board acc, gyro and compass. However the problem is that I am able to read acc and gyro data through primary I2C bus but cannot get any data from compass. Based on the datasheet, I first enabled the I2C bypass mode and then set the compass to single measurement mode. Also I have tried all slave addresses of magnetometer from 0x0C to 0x0E and tried to read many magnetometers' registers like WIA, INFO and HXL to HZH, but the compass never responded. Then instead of connecting to primary I2C, we tried to read magnetometer through Aux I2C bus(ESD, ESC), but didn’t work. Then I used another MPU9150 board and tried the above methods again, but still compass never worked. Based on the above attempts, I was wondering that maybe something is missing in the compass setting. Our part of code related to magnetometer is shown below. Could you guys provide any suggestion? It’s really in hurry! Many thanks for your kind help!

    //Read Mag writeByte(add_slave, MPU6050_RA_USER_CTRL, 0x00); // clear I2C_MST_EN bit to drive Aux I2C bus line by the primary I2C bus msDelay(10); writeByte(add_slave, MPU6050_RA_INT_PIN_CFG, 0x02); //Enable I2C bypass mode to allow MCU to access Mag directly msDelay(10); writeByte(MPU9150_RA_MAG_ADDRESS, MPU9150_RA_MAG_CNTL, 0x01); //Enable Mag to single measurement mode msDelay(10); readBytes(MPU9150_RA_MAG_ADDRESS, MPU9150_RA_MAG_XOUT_L, 6, buffer2);

No public wish lists :(