Electronic – SPI chip select optimisation

digital-logicoptimizationspi

I am designing an SPI system with one master and two slaves. In a normal SPI system, the master needs 2 outputs to control the slaves' chip select lines. I want to use only one output to drive both chip selects thanks to a classic NOT gate.

schematic

simulate this circuit – Schematic created using CircuitLab

I haven't tried this yet because I see one issue:

  • When the master command comes from HIGH to LOW, both chips will be selected for a short time due to the NOT gate delay.

Can this issue cause an overall problem?


Edit:

For this easy scenario, a "not" gate does the job, what is commonly used when there are many more slaves? MUX?

Best Answer

If you really only have two devices, this can work if you're careful. Some points to consider:

  1. Make sure to switch the slave select line only between full sequences and with some dead time before and after you try to transfer data.

  2. Many chips use the leading edge of SS to reset their logic to the start of a new sequence. Even if you are using the same chip several sequences in a row, you will have to de-assert its SS between sequences. This means the other chip will see its SS asserted for short blips. That should be OK, but again, make sure this is only happening when the data and clock lines are quiescent.

  3. The low level firmware may need to do a extra SS pulse to guarantee that the target device sees the leading edge of SS, not just SS asserted at the start of a sequence.