I am using a Mega and connecting various modules which I have managed to get working all individually and am now trying to connect them all up.
I know there are various connection rules (address calls etc.) for SPI and I2c but my first problem is pin name confusion!!
The Mega has dedicated SPI pins on;
50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS).
I am using a MFRC 522 RFID module and it has pin names of;
sda, sclk, mosi, miso, rst. It looks like one pin more than the mega and i'm not sure what SDA and RST are for or how they connect to Mega?
Also I have a ssd1351 oled which has pins;
sclk, mosi, dc, cs, rst so different again!
I am also using a RTC module (I2C) and that has dedicated SDA and SCl pins of 20 and 21 in the library so I dont think I will have issues with that.
If I can get the pin connections straight first for both modules into the mega then I can work out how to address the display and RFID on the bus. Both display and RFID can run from 3.3v so I shouldnt need level shifters?
reading the data sheets it looks like mega pins
MISO (Master In Slave Out) - The Slave line for sending data to the master,
SSD1351 not used MFRC522 MISO
MOSI (Master Out Slave In) - The Master line for sending data to the peripherals,
SSD1351 SDIN - MFRC522 MOSI
SCK (Serial Clock) - The clock pulses which synchronize data transmission generated by the master
SSD1351 SCLK - MFRC522 SCK
MFRC522 requires chip select pin NSS see data sheet section 8.1.2
SSD1351 - CS# is chip select (active LOW) and D/C# selects write command or write data see 8.1.3
Horace gave the right answer. If a chip supports both I2C and SPI you must refer to the datasheet to determine the connections. There is no standard labeling for breakout boards when both I2C and SPI are supported. The datasheet will tell you. Look at table 3 in the MFRC522 datasheet that Horace pointed you to. It shows what the common pins are. You only need 4 pins for SPI.
As far as labeling convention, for SPI the same pin may be called cs (chip select), ss (slave select) or nss (negative slave select), etc. On the master you might find...
SCLK : SCK, CLK.
MOSI : SIMO, SDO, DO, DOUT, SO, MTSR.
MISO : SOMI, SDI, DI, DIN, SI, MRS
SS : nCS, CS, CSB, CSN, nSS, STE, SYNC.
To confuse further, DI (MISO) on the master might be connected to DO on the slave.
I2C is more conventional, always labeled SDA and SCL.
So I think I am connecting the RFID and OLED SPI's together as in the attached.
with the MISO pin being the DC pin on the OLED and the SDA pin on the RFID being the equivalent CS/SS line on the OLED, one CS can go to pin 53 (hardware spi) on the mega and the other to another assigned pin.