Electronic – arduino – Can several CS pins be multiplexed with a shift register

arduinoshift-registerspi

When sharing a SPI data line between several ICs and an Arduino, what exactly are the frequency constrains of the CS pin? Can I use a shift register to multiplex the CS pins (thus only requiring one I/O pin, the Shift Register CS, out of the Arduino)? Or does CS must be synced carefully with SCK (in order to avoid garbage if CS is pulled high too "late")

Best Answer

Data sheets are usually pretty clear on the timing issues related to chip select lines so I urge you to use the relevant data sheet for the device. Some devices can be activated at the same point at which the data is sent to them; other devices need clear space between CS going low and the SPI data being applied.

Yes, you can use a shift register to select just one particular device but this shift register may need flushing regularly to ensure that over time it hasn't "accumulated" an extra low that could cause two chips o be selected simultaneously. In the main I'd use either a 3 to 8 line decoder for chip selects or individual GPIO lines for each peripheral chip.