Problem read compass data

By morten_tychsen , 8 October 2013

Hello,

I'm trying to get compass data from MPU9150 with the MotionAPP 5.1. It seems that the bypass mode does't work. I can even not read the whoamI register of the compass in the mpu_init function. The i2c_read always returns an error (I tried all possible i2c adress for ak8975: 0x0c, 0x0d, 0x0e, 0x0f). On the contrary, it works well when I read the i2c adress of MPU (0x68).

Can any one help me? Thanks!

Yijun

morten_tychsen

12 years 5 months ago

@yijun wrote:

Hello,

I'm trying to get compass data from MPU9150 with the MotionAPP 5.1. It seems that the bypass mode does't work. I can even not read the whoamI register of the compass in the mpu_init function. The i2c_read always returns an error (I tried all possible i2c adress for ak8975: 0x0c, 0x0d, 0x0e, 0x0f). On the contrary, it works well when I read the i2c adress of MPU (0x68).

Can any one help me? Thanks!

Yijun



Any idea for this issue?
phpbb Post ID
24096

morten_tychsen

12 years 5 months ago

I found something strange. When I put an oscilloscope probe on the "ES_DA" or "SDA" pin, it works well. I can read compass register via its i2c adress. But when I don't put it on any of these two pins, the read returns always an error and cannot get data. Any help would be greatly appreciated.

Yijun

phpbb Post ID
24099

ymhsieh

12 years 5 months ago

In your MPU-9150 init, ensure that bypass in enabled by writing 2 to address 0x37, and I2C master is disabled by writing 0 to 0x6A. I would expect the I2C address to be 0x18 for Write and 0x19 for a Read. Hope this helps.

phpbb Post ID
24102

morten_tychsen

12 years 5 months ago

@gary wrote:

In your MPU-9150 init, ensure that bypass in enabled by writing 2 to address 0x37, and I2C master is disabled by writing 0 to 0x6A. I would expect the I2C address to be 0x18 for Write and 0x19 for a Read. Hope this helps.



Hi Gary,

Thanks for your reply. I verified the two registers and the bypass mode is enabled when reading compass adress. The problem is when I add a small capacitor on the SDA pin (in parallel with the pull up resistance on SDA), all work well. Otherwise, I can even not read the whoamI register of the compass.

Yijun
phpbb Post ID
24105
phpbb Topic ID
15678