Multiple use of MISO MOSI on one Nano

Hi,
I have what at first sight I thought was a simple question but have been unable to find an answer. Maybe I am asking the wrong question. Anyway here goes.
Can I have multiple devices all using the same MOSI, MISO, and SCK on one Nano by just having different CS pins?
In my case I have multiple nodes in and RF24 network all collecting data for a Master node. I think an important thing is that the Master is in charge. So the nodes only send data to the Master when the Master asks for it. Otherwise they remain silent. This is all working fine and the Master gets the data when ask for.
The problem comes when the master needs to write the data to an SD card.
The SD card shield uses the same MOSI, MISO, and SCK pins as the Master RF24 radio and has a hard wired CS to pin 10. For the RF24 network the Master is using pins 7 and 8 for CE, CSN.
I am assuming therefore that as the Master / Nodes RF24 system only use the MOSI, MISO, and SCK when the Master is asking for data. The Master can access the SD card shield because this has a different CS and the Master is ensuring that no one else is speaking at the same time.
Am I correct in this assessment?
The next stage is when I need to get the data from the SD card and will need to tell the Master to call for this from the SD and send to me over another RF24 link. This would have been simpler if my SD shield was WiFi / Bluetooth enable but it is not.

Yes, but be aware that some SD card modules reportedly do not terminate the MISO and MOSI connections properly and expect to have sole use of the SPI bus

Yes

What question did you ask before? There is no problem with the above question.

Yes, if done correctly.

The slave devices only speak when their CS/CE pin is low. The master must ensure only one such pin is low at any time. Otherwise more than one slave will try to speak at the same time, resulting in, at best, garbled data received by the master, and at worst, damage to the circuit.

Can you post a link the the shield that you have?

If you are using a classic Nano with an atmega328 processor, be aware that the SD library allocates 512 bytes of ram for a buffer (more if you have multiple files open at the same time), that can be a problem if your code needs large amounts of ram.

Hi Thanks for the input. My "wrong question" observation is because I first tried general internet searching and did not come up with much of any use. Now that I have ask in the correct place I am getting good response.
Regarding the "slave devices only speak when their CS/CE pin is low"
I am using the RF24Network and RF24 libraries and I see that the RF24 library sets ce(LOW) and csn(HIGH) on start up, then ce(HIGH) before a write() and back to ce(LOW) at end of write() and finally ce(LOW) before a shut down.
Unless I am misreading the code is that not the opposite of what you have indicated?

Hi, Thanks for the heads up. I am using the Nano as indicated by you so will keep an eye on overhead. I have restricted the RF24 packets to 32 byte and this is also the size of a write to the SD. Attached is SD detail,


.

Hi Thanks for the comment regarding behaviour of some SD units. I have posted detail of the one I am using. As the Master unit has control of the SD units CS pin 10, if I disable that pin when the Master needs the SD to stay quiet and enable it only when access to the SD is required, would that solve the issue? Alternatively I could have the Master turn the power to the SD OFF / ON as needed.

It appears your shield is the Deek Robot Nano Data Logging Shield, which is discussed in this thread:

https://forum.arduino.cc/t/solved-deek-robot-nano-data-logging-shield/635148

There's a schematic there too, and it looks like MISO is routed correctly. So this module should play well with other SPI devices. However, it may not be so easy to get your software and your libraries to switch the pin they use for CS.

I am assuming the SD card is for temporary storage. There is FRAM that is like EEPROM but without the limitations. You can read/write any location at any time at memory speed. No R/W restrictions, sectors etc. The parts I use are on the I2C bus.

32K by 8 is what I use and they cost less then a pack of cigarettes. The serial parts have the same pinout as the EEPROM. This allows me to plug them into a EEPROM module or in my case since I have RTC clocks I replace the EEPROM on that unit.

Hi Yes temp storage for up to 32Gig.

Hi Thanks for the info. Still getting some bits together but the RF is on CS/CEN pins 7/8 and the SD uses pin10. These are two separate libraries with their own calls so no pin swops. Provided the Master ensures that only RF or SD is active at any one time then I am hoping that the MISO MOSO and SCK lines can be used by either. Have to see how it goes.

Not as I understand it. Whether turning off the power to the module would help, I don't know. In any case, can you do that with the data logging card that you are using ?

Provided the Master saves any data and closes the files before cutting power it should be fine, will let you know how I get on.

Assuming all the SPI devices are accessed using the Nano's hardware SPI peripheral, then they will all use D11, D12, and D13 - because the peripheral uses only those pins. But the CS line is controlled by the libraries. So I think there is a reasonable chance that it will just work - so long as you can specify which pin to use for CS for each device, or for each instance of each device. But I think in the worst case you could select the CS pin in your code. The active one should be low, with all the others high. Can't say I've ever tried that though.

Hi looking at the libraries I see that in the SD all calls for access to the files exit with a Set CS high so it becomes inactive. Likewise for the RF transactions finish with a Set CSN high. Think this should all work, will let you know how it goes. Apologies to all for my earlier confusion mixing up the CE pin settings with the CS/CSN pin.