Arduino Mega SPI limit

I am planning to connect 05 SPI based LS7366R counter ICs, 03 SPI connected stepper motor driver feedback ICs and 01 SPI connected W5500 ethernet controller through SPI of Arduino Mega 2560. So total of 9 devices. I want to ask experts here if this shall be ok to work with this way. Any better way to reduce data and signal consistency risks ?

Did you mean 09 devices? :wink:

I don't know why you put "0" in front of those other numbers, but take care not to do that when you are writing code. In C language, if you put a "0" in front of a number, that indicates that it is written on Octal or base 8. For example if you wrote "012" that would mean 10 in decimal.

Back to your question: yes, should be ok. There is a limit to the number of devices you can connect because of "fan-out". It happens because there is a limit to how many inputs you can connect to the same output. It's probably around 20. The limit can be overcome by using buffer chips. It's not a limitation of the SPI bus.

Which buffer chip can I use ?

Its not said that you need buffer ICs. Check the datasheets of the components for IIH and IIL of the MOSI pins and the SCLK pins.
As an example. if each MOSI pin has an IIH of 1 mA, you sum them and have a total of 9 mA which is below the safe 20 mA (IOH) of the MOSI output of the Mega'so you're OK. Repeat for IIL of the MOSI pins of the devices and check against the safe 20 mA (IOL). And repeat both for the SCLK.

There might be other motivations to use buffer ICs (capacitive load) but that is more for the hardware specialists here.

There are many buffer chips that you could use, such as 74hc04, 74hc34....

But have you changed your design? Are you now planning to connect 20 or more inputs to the same output? You mentioned only 9 before.

A Mega pin has a drive capacity of more than 20mA. I don't think that will be the bottleneck. Wire length (capacitance) is likely your largest enemy, assuming wires are used.
Note that a Mega is using 5volt-logic. Check your slaves for that. I think a W5500 chip uses 3.3volt logic. You might have to use translating buffers for that reason.
Leo..

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.