5
\$\begingroup\$

Is there a limit to how many slaves you can control with a Arduino board using the SPI bus as long as you do not run out of pins?

Uno, for example, has 14 digital I/Os. So theoretically, I could have 11 slaves if I wanted to since MISO, MOSI and SCLK will be shared and there would be 11 different CS pins. I was wondering if anyone would run into any practical problems long before controlling 11 slaves. ( Although I will not use MISO )

I plan on controlling six 12 bit DACs for a project using UNO using the SPI bus. Is there something I need to be aware of?

\$\endgroup\$
7
\$\begingroup\$

The number of SPI slaves is not limited. In fact, you can add digital muxes (multiplexors) and control more slave devices than you have digital pins on the Arduino.

However, the SPI was design for communication over short distances within a box. So, the physical size of the bus can become a problem (bus capacitance, EMI). If you have to make a long-distance ruggedized SPI, there are application notes on the subject: Extending the SPI bus for long-distance communication.

\$\endgroup\$
4
\$\begingroup\$

How fast do you want to run? In terms of the protocol, no, so long as you have enough IO pins to toggle the individual slave selects. Even then, you could go with a fancy scheme like a 3-8 decoder and have even more chip select lines (8) based on the combination of the input lines (3).

The only issue I can think of here might be fanout - that is when you have many devices connected to an output (MOSI pin in this case). It is possible that each extra slave device connected could contribute to some minor capacitive loading - perhaps enough could have some effect. I am not an expert here but it could warrant some investigation if we're talking about real extremes here (dozens or hundreds of devices..?)

\$\endgroup\$
3
  • \$\begingroup\$ I am thinking about dozens, not hundreds. between 6- 11 to be exact. \$\endgroup\$ – Ender Wiggins Jul 24 '12 at 23:41
  • \$\begingroup\$ @EnderWiggins, Technically not dozens. Probably OK to do, you could always test empirically. \$\endgroup\$ – Jon L Jul 25 '12 at 0:49
  • \$\begingroup\$ I've gone up to 5 without problem. \$\endgroup\$ – NickHalden Jul 25 '12 at 3:11

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.