4

I'm working with a project in which I need to use an SD card module and an RFID antenna simultaneously. The devices that I'm using are the MFRC522 and the CATALEX SD Card Adapter. Both have SPI Protocol, and they're using the libraries MFRC522.h and SD.h.

This is the pin layout that I'm using:

/////// For RFID //////////
             Arduino   
             Mega      
  Signal     Pin       
  ---------------------
  RST/Reset  5         
  SPI SS     53 (CUSTOM)
  SPI MOSI   51        
  SPI MISO   50        
  SPI SCK    52        


//////// For SD ///////////
             Arduino   
             Mega      
  Signal     Pin       
  ----------------------
  SPI SS     49 (CUSTOM)       
  SPI MOSI   51       
  SPI MISO   50        
  SPI SCK    52   

As you can see the only line that they are not sharing is the Slave Select (aside from the RST pin of the RC522 module), so I believe that my wiring is correct.
I tried setting in LOW the chip select of the device that I wanted to use and in HIGH the one that I didn't. But this didn't work.

Any help you could provide would be appreciated! Thanks!

Pinedo98
  • 43
  • 2

2 Answers2

0

If that SD card adapter looks similar like the picture, I never could get it to work together with another SPI device.

What I used was a data logger shield for Arduino (with SD card slot and proto part, unused in my case), something like this: SD logger

enter image description here

Michel Keijzers
  • 13,014
  • 7
  • 41
  • 58
0

I have a few of those in my parts box and I have left a little note with them that says "exlusive SPI" to remind myself. A search brings up this which seems to confirm it. The OP's solution of powering it on and off with a pin seems pretty smart to me - assuming it doesn't draw too much current from the output pin.

Update: I found this which suggests that powering the SD card adapter from an output pin is a bad idea. The card could be drawing more than the pins can reliably supply.

Crispy
  • 76
  • 4