Electronic – SPI naming, SDI/MOSI confusion

pinoutspi

I'm wiring an MPU 9250 in an SPI bus, and according to datasheet, the same pin as I2C SDA is SPI SDI:

enter image description here

Which leads me to think that since this is Data Input in the slave (MPU9250), would be equivalent to MOSI.

Wiring diagram in the datasheet seems to confirm this:

enter image description here

However, I was reading the SPI page on wikipedia (Ok, not the greatest source) and it says:

The MOSI/MISO convention requires that, on devices using the alternate names, SDI on the master be connected to SDI on the slave

Which confused me a bit. In the diagram, SDI is wired with SDO and naming is relative to the device the pin is in, which contradicts wikipedia (SDI naming is always relative to the master).

So, in essence, is the Wikipedia article wrong? Can I trust my assumption that SDI on the MPU = MOSI?

Best Answer

Devices other than MCUs having SPI interface tend to use SDI/SDO or DIN/DOUT convention (e.g. ADC/DAC chips, digital potentiometers, sensors etc). But MCUs always (maybe there are exceptions but I've never faced one) use MOSI/MISO convention (MSP430 series MCUs have a slight difference at this point: They have SIMO/SOMI pins which are totally the same as MOSI/MISO). This is because the MCUs are assumed (which should be) to be master.

NOTE: If two MCUs are communicating through SPI then the "master" tag alternates between the two (i.e. sender becomes "master" at the time), but the connection does not change: MOSI on the 1st chip connects to MISO on the 2nd chip and vice-versa.

Anyway, SPI data pins are not bi-directional buffers, so SDI pin on one chip should always be connected to SDO (or MOSI) pin on the other chip.

So,

  • The statement you've quoted from WP is totally wrong. SDI on a chip be connected to SDO on the other chip, regardless of whichever is assumed to be master or slave.
  • As I stated in the explanation above, SDI on the MPU9250 be connected to MOSI (master's out - slave's in) on the microcontroller/microprocessor.