1
\$\begingroup\$

SPI allows multiple slaves to be connected together in two ways. One is Multiple-Slave-Select Configuration and the other is Daisy-Chain Configuration. Since the different slaves may be entirely different devices, I think that Daisy-Chain Configuration is not usually possible.

Is it always possible to use a Multiple-Slave-Select Configuration when we wish to connect multiple masters to a single master SPI? Uptill now I have come across scenario where the logic levels (atleast output) of a slave may not be compatible or a slave may not have tristated output when CS is not asserted (which I find strange). Are there any other problems too?

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

If the slaves are well-behaved, then there should be no issues with mixing slaves with different SPI modes in the same system, so long as you don't mix them under the same chip select, and you make sure to properly configure the master to use the mode that corresponds to the devices being addressed.

As you surmised, daisy-chaining SPI devices is not done particularly often. Generally this requires devices that are specifically designed to support being daisy-chained, which is not always the case. There are a couple of issues with daisy-chaining: first, the data register needs to be transparent - i.e. whatever gets shifted in eventually has to come out the other end unchanged, otherwise daisy-chaining is impossible. The other issue is that you're essentially forced to address all of the devices in the chain, which can be inefficient or even cause problems if you really only want to interface with one link in the chain. However, for devices that do support daisy chaining, it can be an excellent way to save on chip select lines.

Obviously, you'll need to use level translation and possibly tristate buffers or bus switches to interface with devices that have differing voltage requirements or badly-behaving MISO pins as necessary.

Multiple masters is certainly possible as well, but you'll have to do some sort of out-of-band arbitration to eliminate contention and it may also be necessary to use multiplexers or bus switches to control which master has control over the necessary signals.

\$\endgroup\$
2
  • \$\begingroup\$ Talking about multiple masters, are there external ICs that can be used as arbitraters for a multiple master system for anything like parallel transfer, SPI and I2C? \$\endgroup\$
    – quantum231
    Apr 23, 2018 at 20:06
  • \$\begingroup\$ One thing to note is different modes can have different idle/initial states for the SCLK line. Be sure to switch to a new mode before pulling down the CS pin for the start of a communication so the slave in question doesn't see the SCLK at the wrong level at the start which could lead to undefined behaviour. \$\endgroup\$
    – tom r.
    Aug 20, 2021 at 3:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.