Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
1  
What digital output? SPI has data in, data out, clock in, and chip select in. What is this digital output of which you speak? –  Majenko Jul 16 at 9:17
    
@Majenko edited my question –  joaocandre Jul 16 at 9:27

2 Answers 2

up vote 7 down vote accepted

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.

share|improve this answer
1  
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. –  Wouter van Ooijen Jul 16 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

share|improve this answer
    
What you describe there is a JTAG bus. –  Majenko Jul 16 at 10:20
    
@Majenko - it may also be described as a JTAG bus but ADI and maxim call it daisy chaining SPI devices and so does Wiki –  Andy aka Jul 16 at 10:22
    
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. –  Michael Karas Jul 16 at 10:56
    
@MichaelKaras note that in my answer I said "For different devices, they must have a compatible data out" –  Andy aka Jul 16 at 11:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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