0
\$\begingroup\$

I'm working on a project where I have one master device and 64 slave devices. I'm facing a challenge with the SPI protocol's limitation in terms of the number of Slave Select (SS) lines needed for connecting a large number of devices.

Here's my setup and approach:

  • Each slave device is connected to an I2C bus.
  • There's also an SPI bus connected to all the slaves. However, the SS signal for each slave is configured so that the device is always selected.
  • The logic I intend to use is as follows: Before sending or requesting data, a specific slave is selected via the I2C bus. Then, the SPI part of the selected slave is activated for data transmission.

My question is: Can this approach effectively manage the communication with multiple SPI slaves, using I2C for slave selection? Are there any potential pitfalls or better methods to handle such a scenario?

I'm looking for insights, suggestions, or examples of similar implementations. Any help or guidance would be greatly appreciated.

\$\endgroup\$
2
  • \$\begingroup\$ Depends what ICs the slaves are. Not using SS is a red flag for sure. So is tying SPI MISO pins together. Along with having a total of 65 devices on same I2C and SPI bus. How long will the bus be? How do you allocate 64 different I2C addresses, to enable one chip for SPI? And switching between SPI devices will depend on I2C speed. \$\endgroup\$
    – Justme
    Nov 16, 2023 at 5:10
  • \$\begingroup\$ Why go to the trouble of using I2C for slave selection? Just put a slave address byte at the start of the SPI data sent from the master. All slaves always receive the data but only the one who's address matches that slave address byte sent by the master is the one which responds or processes the data. \$\endgroup\$
    – brhans
    Nov 16, 2023 at 14:08

1 Answer 1

0
\$\begingroup\$

You are pushing SPI and I2C beyond their intended usage; you don't say how long the bus lines would be, but I'd be concerned about noise pickup causing unreliability.

With regard to alternative solutions, some SPI devices support 'daisy-chaining', where the device repeats any input data in addition to outputting its own data, and this would be an easy way of solving the problem.

Failing that, I'd probably group the SPI devices in blocks of 8 or 16, and use a microcontroller to gather their data, using I/O lines as chip-selects. Then link the micros together using any method you like; SPI, RS485, or even WiFi, since you can get a wireless module at very little cost.

\$\endgroup\$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.