SPI communication for multiple slave devices over a network

I am working on a setup that needs to have multiple devices communicating over a network. There will be 1 Master device and numerous Slave Arduino devices (possibly 40-50).

I wanted to setup as an intranet, but looking at the infrastructure cost, I don't think its preferable to have all that cost of extra equipment if the network won't span beyond a few meters. And then I'll have to stick to HTTP or TCP/UDP if I choose to go with intranet.

Coming to SPI, from my past experience, I know that there are 4 connections (for data transfer) between a Master and a Slave where 3 can be common for multiple devices - MSIO, MOSI, CLK while the fourth connection is CS, that will be unique per slave. Looking at the number of Slave devices I will surely have issues with limited number of GPIO on my Master device.

I came up with a hypothetical setup. Please refer to the attached screenshot with block diagram.

I have added multiple shift registers (for example 74HC595 - can control 8 slaves with 1 such chip), that would be used over SPI0 of Master, and would be responsible for handling the CS (Chip select for the Slaves), while SPI1 of Master will be used to send data to all the Slaves. The one with Chip Select set to low will communicate with the Master. So technically, I will be using 4 pins for SPI0 and 4 pins for SPI1 for all the communication, instead of 50 (CS)+4(SPI) for a 50 slave device network.

I wasn't able to test with a practical setup, since I don't have enough MCUs handy to hook them up for the test, and I'm yet to decide on the network.

I know I shouldn't be asking for an opinion on this forum so I will limit my questions to below:

  1. Has anyone seen a practical implementation of such a network?
  2. Is this even possible (using Shift registers for chip select).
  3. Is synchronized communication between multiple SPI ports is even possible? Can I use the same SPI for switching between Shift registers and Slaves, if there is a sync issue.
  4. Are there any other tradeoffs of using SPI communication over such a network (with devices over 40-50). One would of-course be the data transfer speed.

cyberpks:
Looking at the number of Slave devices I will surely have issues with limited number of GPIO on my Master device.

Unlikely if you use a Mega.

Or what about using boards based on the ESP8266 or ESP32 which have WiFi and ESP-NOW as standard.

...R

Robin2:
Or what about using boards based on the ESP8266 or ESP32 which have WiFi and ESP-NOW as standard.

I can't use Wi-Fi communication (due to possible noise interference of other electronic devices) so may be an Arduino or STM32 based boards as slave and Raspberry Pi as Master.

Reason for not using a Mega as Master is the processing capacity of master needs to be enough to handle all 40-50 slaves in the network. So I'd prefer a faster processor and enough memory to handle all these slave devices.

Based on the info supplied, I'd use a CAN buss as the network instead of SPI.

You can have an ESP32 as the brain and STM32 Bluepills as the remotes. ESP32 and STM32 are, out of the box, can bus ready. All you need are the CAN buss transceiver modules.

Idahowalker:
Based on the info supplied, I'd use a CAN buss as the network instead of SPI.

This seems very promising, Thanks!!. I am reading through the documentation. Will update as soon as I understand it completely.
One question that popped up in my mind as soon as I saw a DB9 connector on one of the CAN bus transceiver module on Amazon, and also out of curiosity, is that can I connect the whole network with a computer as well using its DB9 port, and make it work as a master instead of having an ESP32 or a RPi do this job? Because in the end the whole controlling of these devices will be done by a person using a computer. So rather than introducing one Master MCU separately, can I just connect it to my computer?

I've not had such interest in connecting a CAN buss to a PC so I've not looked into the matter but what were your results when you typed words like "can bus to pc adapter" into your internet search engine?