mpu-9250 ? SPI

Anyone work new mpu-9250 with spi connection ?

yes me, I finally go more than FF's or 00's back from the chip

transmitSPIcontinue is because I'm using a Due

void    setup(void)
{
    SPI.begin(10);
    SPI.setClockDivider(10, SPI_CLOCK_1MHZ);
    delay(3000);
    tmp = readRegVal(MPU9250_WHOAMI);
    if (tmp != 0x71)
    {
      Serial.print("whoami fault ");
    }
}

uint8_t readRegVal(uint8_t cmd)
{
  uint8_t res;

  transmitSPIcontinue(cmd | 0x80);
  res = transmitSPI(0);

  return res;
}

uint8_t transmitSPIcontinue(uint8_t val)
{
  uint8_t  tmp;
  noInterrupts();
  tmp = SPI.transfer(10, val, SPI_CONTINUE);
  interrupts();
  return tmp;
}

uint8_t transmitSPI(uint8_t val)
{
  uint8_t  tmp;
  noInterrupts();
  tmp = SPI.transfer(10, val,SPI_LAST);
  interrupts();
  return tmp;
}

moderator: code tags added -> # button above smiley's

Hi, I am trying to use MPU 9250. I was able to connect to it with a raspberry Pi and I2C but I am not sure how to connect to it via SPI. The datasheet is not very clear on that. They talk about setting some bit in some register to prevent the device from switching to I2C mode, but it already starts in I2C mode.

I see you are already working with MPU9250 with SPI. Could you elaborate on the steps that need to happen to enable the SPI communication. I really need the SPI as I want to read at the highest possible speed and the I2C is not fast enough.

By the way, for those that are interested the datasheet says the I2C communication can be up to 400KHz. Just for reference you can drive it at 1MHz and it still works.