Frequently Asked Questions
Mon-Fri, 9am to 5pm
U.S. Mountain Time:
Chat With Us
April 12, 2013
about 2 years ago
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!
writeByte(add_slave, MPU6050_RA_USER_CTRL, 0x00); // clear I2C_MST_EN bit to drive Aux I2C bus line by the primary I2C bus
writeByte(add_slave, MPU6050_RA_INT_PIN_CFG, 0x02); //Enable I2C bypass mode to allow MCU to access Mag directly
writeByte(MPU9150_RA_MAG_ADDRESS, MPU9150_RA_MAG_CNTL, 0x01); //Enable Mag to single measurement mode
readBytes(MPU9150_RA_MAG_ADDRESS, MPU9150_RA_MAG_XOUT_L, 6, buffer2);
No public wish lists :(
Forgot your password?
No account? Register one!