0
\$\begingroup\$

enter image description hereI am using SPI in my design with Single master three slaves ,Using chip select i will enable two slaves at a time.

Is this correct , if no please let me know why ?

\$\endgroup\$
3
  • \$\begingroup\$ Imagine your first slave will want to put 0V on the MISO line, and your second slave will want to put 3.3V there. Because they are both activated, they will "fight" over the voltage, in other words, there will be short circuit, possibly damaging one of the slaves. \$\endgroup\$ – akwky Jul 28 '20 at 7:13
  • 2
    \$\begingroup\$ It depends on what chips they are and how you have connected them. Since you did not provide this info, we cannot say if it works or not. Please provide the chip names and connections. \$\endgroup\$ – Justme Jul 28 '20 at 7:56
  • \$\begingroup\$ Chips are two DAC & one ADC \$\endgroup\$ – Puneeth Jul 30 '20 at 12:41
0
\$\begingroup\$

No. Each device has to have its own chip select - CS. The other signals are common to all slaves SCLK, MISO, MOSI.

\$\endgroup\$
4
  • 2
    \$\begingroup\$ That is an awfully general statement which is usually but not always true. There are chips with SPI bus that can be chained so that single chip select can be used for them. Then there are chips that must be alone on the bus so that it can't be shared with other devices unless special care is taken to solve it. \$\endgroup\$ – Justme Jul 28 '20 at 8:01
  • \$\begingroup\$ what happens if enable two chip select at time, If I want to read the data from the two slaves at time how can i do that \$\endgroup\$ – Puneeth Jul 29 '20 at 6:04
  • \$\begingroup\$ No, you can't. What are those slaves? If you want to read data acquired at the same time, the slaves should have a sync input. \$\endgroup\$ – Marko Buršič Jul 29 '20 at 6:24
  • \$\begingroup\$ Slaves are two DAC & one ADC \$\endgroup\$ – Puneeth Jul 30 '20 at 12:39
0
\$\begingroup\$

The whole purpose of chip select/slave select pin is to have 1 slave device talking at a time, so that all others ignore the data and only the selected chip will receive/process/respond to it. In I2C, for example, you have an address system, where everyone is connected to the same buses and just waiting for master to call slave's ID, slaves ignore the communication with other slaves. In SPI you pull slave's pin down, the slave knows you're talking to it. Everyone else sitting on the same datalines just ignores this communication, their CS is not pulled low, they're not told to listen. So you need a CS signal for every SPI device, which is the SPI's drawback. But it's faster than I2C, that's the advantage. But yes, be ready to spare for pins for SPI CSs.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Like I already commented another answer, what you say is usually true but not always. Sometimes multiple slave chips can be handled with single CS pin, and sometimes a slave chip is not able to share the bus with other devices without adding other circuitry. So it depends on what SPI chips the OP has, and we don't know that yet. \$\endgroup\$ – Justme Jul 28 '20 at 8:57
  • \$\begingroup\$ well just like you can have multiple I2C devices with the same address, say, they both receive only. No ACK conflicts occur (dronebot workshop yt channel demonstrates 2 I2C OLEDs connected together showing the same image). But yeah, sure, you can always look into specific case where you can do things differently in your particular case while not violating the spec. You're right of course about it! \$\endgroup\$ – Ilya Jul 28 '20 at 9:00

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.