I'm having problems accessing the magnetometer data from a MPU9250 via SPI (I'm using a RFduino). The accelerometer and gyroscope values are coming through fine via SPI but the magnetometer readings are still zero even though I'm accessing it via I2C, etc. etc. Can you guys take a look at the code and see where I'm going wrong?
The device is attached to the GPIO2 thru GPIO 5 pins of the RFduino.
I'm accessing the data via SPI but within the IMU chip, the magnetometer is separate from the accelerometer and gyroscope. It's an AK8963 chip that can't be accessed via SPI. From my understanding, I have to set the AK8963 as an I2C slave to access the magnetometer data. Internally, the AK8963 sends data via I2C to the IMU but from the IMU to the Rfduino, it can be SPI.
PaulS:
Are those the SPI pins? On an Arduino, they are not.
Then, you would be reading the data from the IMU, using SPI. How the IMU and the AK8963 communicate is no concern of yours.
Yes they are the SPI pins for a Rfduino.
I'm not entirely sure if I get what you mean. I have to configure the IMU to be able to access the AK8963 data and I am unable to do that at the moment.
It turns out my code was fine but on my custom board I had not connected pin 1 of the MPU9250 to VDDIO. The data sheet that invensense supplies has a discrepancy. On one page it says that it needs to be connected and on another it shows it as floating. This solved the problem for me so I hope that this might help in your situation.