Hi everyone,
I am trying to get SPI working in combination with an MPU9250 gyroscope. I get it configured, and can write fine to the MPU to get it responding with the right information. The issue is however the reading.
For instance, with the command:
var writeBytes = new byte[] { 0xC1, 0, 0 };
var readBuffer = new byte[3];
_spiDevice.TransferSequential(writeBytes, readBuffer);
I sent the read request for a temperature-reading (value 193) and ask for two response bytes (the two 0’s). I see with the Logic analyzer the following response:
0xC1/0x00 0x00/0x07 0x00/0x89 0x00/0xFF 0x00/0xFF 0x00/0xFF
So, I would assume my read buffer would contains the value 0x00, 0x07 and 0x89. However, I receive in the end the values: 0x89 0xff 0xff
I am not really sure how I should interpret this, and how I can receive also the 0x07 value. I have already tried to sent multiple Transfers, but then the response gets empty as the chip select goes down, and the chip doesn’t know what to return anymore. Has anyone some insights how I should use this SPI-commands to retrieve all the results?
For clarification also an image from logic: