Is it possible to cascade several different ICs on the same data line, in order to use less CS pins, by tying the digital output of each to the digital input of the next? I am familiar with this approach on similar/equal devices, but I'm not sure if there are some additional issues I should be watching out for.

EDIT: By digital output I pin the output pin many SPI devices provide, e.g. MAX395 or 74HC595 Shift registers.

  • 1
    \$\begingroup\$ What digital output? SPI has data in, data out, clock in, and chip select in. What is this digital output of which you speak? \$\endgroup\$ – Majenko Jul 16 '14 at 9:17
  • \$\begingroup\$ @Majenko edited my question \$\endgroup\$ – joaocandre Jul 16 '14 at 9:27

No, you cannot do what you are thinking (if you are thinking what I think you are thinking) with just any SPI devices.

The devices you have pointed to are not SPI devices, but shift registers. They do not operate in quite the same way as SPI, however SPI can be used to drive them.

They are actually more akin to JTAG than SPI.

In a shift register or JTAG device the data input (TDI in JTAG parlance) is fed into a simple shift register, and the final bit output of the shift register falls out into the data output (TDO in JTAG). That's not how SPI works.

In SPI the SDI and SDO pins are completely separate and the relationship between the data in one and the data in the other is purely down to the whims of the chip. It is common to clock in a command or register location into the SDI pin and, on the next byte, the contents of that register is clocked out of the SDO pin.

So no, the input doesn't "fall over" into the output like a shift register.

If you want to reduce the number of CS pins used then you could use, say, a 74HC154 4-to-16 decoder to connect 15 devices to just 4 CS pins (reserve 1 pin for "no device selected").

If all your devices are shift registers, or operate like shift registers, and not real (register based) SPI devices, then you may be able to cascade them if they all work in the same way. That, of course, is not guaranteed unless they are all the same device.

  • 1
    \$\begingroup\$ What OP asks is possible with the SPI-like chips that provides a 'chained' data input or output, as is the case with common shift registers. But I agree that the normal SPI chips do not provide such pins, so they can't be cascaded. Note that chips like the MCP23S16 provide an I2C-like addressing mechanism that allows them to be put in parallel. \$\endgroup\$ – Wouter van Ooijen Jul 16 '14 at 10:10

There are several devices (especially ADCs) that have a data out pin and "daisy chaining" them is common practice. In effect if you want to talk to 3 devices you have to ripple the data thru the first and second device to get to the third. If this doesn't cause a problem then yes, it will work: -

enter image description here

Hope the diagram makes sense - notice there is a common CS line that feeds all three devices. For different devices, they must have a compatible data out and some require a pull-up on the data out but I don't see why it cannot be achieved. Here's a more general picture: -

enter image description here

On this you can actually read back into the master what you have "put-out" - the beauty of this is that you can check how many bit transitions it takes to fill-up the array of shift registers spread on the slave chips.

Wiki may also be quite helpful

  • \$\begingroup\$ What you describe there is a JTAG bus. \$\endgroup\$ – Majenko Jul 16 '14 at 10:20
  • \$\begingroup\$ @Majenko - it may also be described as a JTAG bus but ADI and maxim call it daisy chaining SPI devices and so does Wiki \$\endgroup\$ – Andy aka Jul 16 '14 at 10:22
  • \$\begingroup\$ Daisy chaining works with some SPI devices and not with others. It really is like @Majenko says, "It's up to the whim of the chip designer". So Andyaka your answer, while being correct for certain devices, could be construed as being misleading for the general case. \$\endgroup\$ – Michael Karas Jul 16 '14 at 10:56
  • \$\begingroup\$ @MichaelKaras note that in my answer I said "For different devices, they must have a compatible data out" \$\endgroup\$ – Andy aka Jul 16 '14 at 11:02

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.