1

I'm using a Genuino MKR1000 and I want to use the SPI interface, which I've seen that there is no Slave Select (SS)/Chip Select(CS) pin usage.

How can I use the SPI interface with multiple slaves then?

enter image description here

asked Jan 13, 2017 at 15:10
15
  • What doesn't have a slave select pin? Commented Jan 13, 2017 at 15:12
  • I don't know... (question edited to see that there is no SS/CS pin) Commented Jan 13, 2017 at 15:17
  • Question: how do you use SPI with just one slave...? Commented Jan 13, 2017 at 15:18
  • 1
    @waas1919 Yes, the Arduino doesn't care what pin you use for SS since you just use digitalWrite() on it anyway. You use any pin you like for one slave, so you can use any other pin you like for another slave. Commented Jan 13, 2017 at 15:39
  • 1
    Some libraries require a specific pin, but on most you can specify your own. Commented Jan 13, 2017 at 15:41

2 Answers 2

3

The Arduino doesn't care what pin you use for SS since you just use digitalWrite() on it anyway. You use any pin you like for one slave, so you can use any other pin you like for another slave.

The ATMega-based boards need pin 10 to be set as an output for SPI to function, but you don't then have to use that for the actual slave select. The only time it becomes a real slave-select pin is when using the Arduino itself as a slave.

answered Jan 13, 2017 at 15:42
4
  • How does SPI.transfer knows where to send data? Commented Aug 31, 2017 at 11:20
  • It sends it out through the SPI port. Commented Aug 31, 2017 at 11:28
  • If a slave is connected to pin 3, we can set it to low and transfer data. But what if other pins say 4, 5 are also low. Now how does spi knows which is slave select? Commented Aug 31, 2017 at 12:06
  • 1
    Slave select is the pin that is low that is connected to the chip select pin of a slave. SPI neither knows nor cares what it is. If the slave's chip select pin is low then the slave is listening to the bus. Commented Aug 31, 2017 at 12:07
1

If the number of slaves is large, consider using a multiplexed arrangement for select lines. As an example, the 16-pin 74LS138 Decoder/Demultiplexer pulls one of eight lines low depending on the state of its three address lines, while the 24-pin 74LS154 pulls one of sixteen lines low depending on the state of its four address lines. Both of these chips have two or three enable lines, allowing use of two to four of them together to multiply the number of output lines by two to four via use of one or two more address lines.

answered Jan 14, 2017 at 0:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.