MPU-9250s are unresponsive via SPI

Hello, I am getting started with MCUs and have bought two MPU-9250 breakouts:

https://www.sparkfun.com/products/13762

Here are the relevant docs for it:

Reference 1: Datasheet: https://cdn.sparkfun.com/assets/learn_t … REV1.0.pdf

Reference 2: Registers: https://cdn.sparkfun.com/assets/learn_t … er-Map.pdf

I’ve wired two of them up, and thus far haven’t gotten a response from either of them, and I’ve double checked everything. Below I’ve listed all of the stuff I’ve double and triple checked, and still no response, so I wonder if I’ve got two bad parts.

Can anyone with some experience with the MPU-9250 (or similar parts) scan the list below and see if anything is missing that could be causing my lack of communication? Or suggest other troubleshooting tips before I start over with a different part?

Thanks!

Details of what I’ve done to establish communication… anything wrong or missing?

  • Power: I am supplying the MPU-9250 with 3.2V, and the allowable range is 2.4V-3.6V (Ref 1). On my power supply I see that the part is drawing 0.005A, so I think that’s a good sign that there is a small power draw.
  • - SPI Mode: Section 7.5 of the datasheet (Ref 1) says data on the rising edge, which I think is mode 0 (CPOL=0,CPHA=0), which is how I have configured my master SPI peripheral (but have tried all modes)
  • - SPI Clock frequency: Section 3.6 of the datasheet (Ref 1) says a max of 1MHz, I am setting the SPI clock to 500MHz (but have tried several speeds)
  • - Direction: Section 7.5 of the datasheet (Ref 1) says MSB first, my MCU SPI is configured this way, as you can see in Figure 1
  • - Connections. I’ve double checked these, I think they are correct. I have the Saleae logic analyzer connected to monitor the traffic, so I included that.

    o MPU-9250 Pin 24, SDI ↔ Controller MOSI ↔ Saleae Pin 2

    o MPU-9250 Pin 23, SCK ↔ Controller SCK ↔ Saleae Pin 0

    o MPU-9250 Pin 9, SDO ↔ Controller MISO ↔ Saleae Pin 1

    o MPU-9250 Pin 22, nCS ↔ Controller Select ↔ Saleae Pin 3

  • - Data sent: I am trying to perform a read on register 117, which is the WHO_AM_I register, and should have a default value of 0x71. To read register 117, we set bit 0 to 1, and then the next 7 bits to the register address, so the whole thing is b11110101 = 245=0xF5. I then send another byte of zeroes, and I expect the device to clock back the default value of 0x71. As you can see in Figure 1, I am getting back zeros. (And have never seen anything but zeroes on MISO.)
    • Edit: I have no idea why the PNGs I try to upload are “invalid”, but the logic analyzer output shows sending in ‘245’, then ‘0’ and receiving back ‘0’,‘0’. As described above that is a read of register 117 (WHO_AM_I), and the expected response is 0x71, but I’m getting zeroes.

    Well my logic analyzer PNGs still won’t upload… very annoying.

    But I thought of a possible problem with my setup, I was powering my controller board via USB and my MPU-9250 from a standalone power supply. I changed that, powered the MPU-9250 breakout board from VDD (3V) and GND on my controller board. Still no peep out of the MPU-9250. Disappointing…

    And overall, this really kind of stinks. Sunk a bunch of hours into this… I really hope someone more experienced setting up SPI connections can give me some ideas about where to look.

    I have no trouble using I2C connections with the MPU-9250. Is there some compelling reason to use SPI?

    At the very least, your could use the I2C connection to verify that the MPU-9250 is actually functional.

    Simpler, faster (don’t fully understand why yet but SPI is supported up to 20mhz on this and it appears I2C is not), and also the wire length that SPI supports is longer, which is helpful for my application.

    You’re right I could use I2C to verify its functional. That’s kind of a long way around, but I’m almost to that point. So no apparent problems or oversights in my approach?

    If SPI doesn’t work, it is not “simpler, faster”. I hardly ever use SPI, because I don’t find it simpler, it requires an extra pin and wire, and speed has never been an issue.

    But this SURELY will not work:

    I am setting the SPI clock to 500MHz

    Well, hopefully it does work and I’m doing something a little bit wrong. Otherwise they should add “…but it doesn’t work” to the otherwise impressive specs. :slight_smile:

    That was a mis-type, I’m setting it to 500khz. That should work, right? (I’ve tried several speeds so I don’t think that’s the problem.)

    Who could possibly know? You forgot to mention what you are using as an SPI master, forgot to post the code, failed to mention ground and power, etc.

    The SPI master is irrelevant and would overcomplicate the question; it works fine (as the logic analyzer image would have shown) and talks to other things. I did mention ground and power. Rather than code I simplified it to a detailed bullet list of exactly what I’m doing, which is exactly what a reader would look for in the code. So, yes, someone who has made this work could obviously look at my list and notice if there’s anything I overlooked. If you don’t notice anything like that, beyond the obvious typo you seized on, you might just say so rather than complaining about the question a week later.

    Good luck with your project!

    Thanks, take care.