Hello,
I am trying to read the WHO_AM_I registers on the MPU9250 to check that the I2C communications are working correctly. There are two WHO_AM_I registers, one for the 9250 section (accelerometer and gyroscope) and one for the magnetometer section, (AK8963).
I can successfully read the 9250 WHO_AM_I using the following sequence:
I2C Start
Transmit byte 0xD0 (9250 ID)
Transmit byte 0x75 (9250 WHO_AM_I)
I2C Restart
Transmit byte 0xD1
Who_9250 = Receive Byte
I2C Stop
This reads 0x71 which is correct.
When I try to read the WHO_AM_I register for the AK8963 section I read 0xFF instead of the expected 0x48. The sequence I have used for this is:
1/ Set MPU9250 to bypass mode
I2C Start
Transmit byte 0xD0 (9250 ID)
Transmit byte 0x37
Transmit byte 0x02
I2C Stop
2/ Then read the AK8963 WHO_AM_I register
I2C Start
Transmit byte 0x0C (AK8963 ID)
Transmit byte 0x49 (AK8963 WHO_AM_I)
I2C Restart
Transmit byte 0x0D
Who_ AK8963 = Receive Byte
I2C Stop
Would someone please have a look to see what I have done wrong?
The program in written in Flowcode 6 for a PIC16F1827.
Thanks,
Dave.