How to share MISO/MOSI/SCK/CS/SS

Hello

I have
1- ENC28J60 Ethernet Module
2- RC522 RFID
3- 3.2" TFT LCD Touch + TFT 3.2 inch Shield

TFT WEB LINK

4- Arduino Mega 2560 R3

the Mega board ports located on
SCK = Pin 52
MISO = Pin 50
MOSI = Pin 51
CS = Pin 53

the TFT 3.2 inch Shield already connected to 52/50/51/53 pins
when i sold the ethernet pins to the 52/50/51/53 pins
the touch screen and the ethernet card stop to work
when i disconect the ethernet card i can use the TFT
and when i desconnect the TFT and connect the ethernet card i can get DHC

so my project need the 3 hardware TFT , RFID ,Ethernet
so how can i connect the 3 hardware to the Mega boars ??

thanks

SPI lets you connect multiple slaves, they need to have a different SS (Slave Select) - also called Chip Select (CS)

Read thix or that to understand more

then you need to ensure your libraries and hardware are playing "safely" with the protocol... that's not always a given...

SCK, MISO and MOSI can be same but the SS for each device must be different !! ??

the quation can i use any of unused pins for SS ??

in another way if Mega 53 pin is SS and use it for the TFT
so for example i can use pin D4 Like SS for Ethernet Module ???
and pin D5 Like SS for RFID ??

IS That right ???

SCK, MISO and MOSI can be same but the SS for each device must be different !! ??

Yes.

the quation can i use any of unused pins for SS ??

Yes, even the analog inputs can be configured as digital outputs.

in another way if Mega 53 pin is SS and use it for the TFT
so for example i can use pin D4 Like SS for Ethernet Module ???
and pin D5 Like SS for RFID ??
IS That right ???

I don't see why not as long as all those devices properly share the SPI bus.

mkdirs:
IS That right ???

Yes.

You don't even have to use pin 53 as one slave's control (unless it's hardwired of course, like on a shield.) The only rule is that pin 53 (10 on a Uno) must be made an output, else if it was an input it may get taken low and then turn the Arduino into a slave. Once you have it an output, you might as well use it to control a slave, but you're not forced to.

The code that controls each device on the SPI bus much properly assert and de-assert the CS (i.e. SS) at the appropriate time. So, if it has a hard-coded CS pin, you either need to use that or change the code.

EDIT:
A decent library will take a CS pin as part of its constructor or begin() function.

neiklot:
Yes.

The only rule is that pin 53 (10 on a Uno) must be made an output, else if it was an input it may get taken low and then turn the Arduino into a slave.

OK thanks i understand how it works

If arduino like master the main SS port must be output else if the SS port like low thats will make the board slave