Hi
I use an Arduino Due and try to communicate with two MPU-9250 with daisy chain.
I wired it like this:
MOSI -> SDI 1
SDO 1 -> SDI 2
SDO 2 -> MISO
Same GND, VCC and CS
I now like to get the temperature (register 0x41 tempH, register 0x42 tempL).
I programmed the following code to first get the values in tempH and then tempL.
Issue is it doesn't work. I connected a logic analyzer to the MISO and MOSI pins from the Due but it's not what I expected (tempH have to be 0x03, and in daisy chain twice).
So can anybody help me here?
void setup() {
Serial.begin(9600);
pinMode(csPin,OUTPUT);
digitalWrite(csPin,HIGH);
SPI.begin();
mpuConfigure();
}
void loop() {
// high register
SPI.beginTransaction(SPISettings(SPIclk, MSBFIRST, SPI_MODE3));
digitalWrite(csPin,LOW);
SPI.transfer(0x41 | 0x80);
buffer[0] = SPI.transfer(0x41 | 0x80);
buffer[1] = SPI.transfer(0x41 | 0x80);
digitalWrite(csPin, HIGH);
SPI.endTransaction();
delayMicroseconds(10);
// low register
SPI.beginTransaction(SPISettings(SPIclk, MSBFIRST, SPI_MODE3));
digitalWrite(csPin,LOW);
SPI.transfer(0x42 | 0x80);
buffer[2] = SPI.transfer(0x42 | 0x80);
buffer[3] = SPI.transfer(0x42 | 0x80);
digitalWrite(csPin, HIGH);
SPI.endTransaction();
// calculation
tempCache1 = ((int16_t)buffer[0] << 8) | buffer[2];
tempCache2 = ((int16_t)buffer[1] << 8) | buffer[3];
tempC1 = ((tempCache1 - 21.0) / 333.87) + 21.0;
tempC2 = ((tempCache2 - 21.0) / 333.87) + 21.0;
// output
Serial.print("MPU 1: ");
Serial.println(tempCache1);
Serial.println(tempC1);
Serial.print("MPU 2: ");
Serial.println(tempCache2);
Serial.println(tempC2);
}

