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!

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

  • That's the exact same SD adapter that I have. What I did was connecting the Vcc of the SD adapter to an specific pin, and whenever I want to use it I have to set a HIGH signal on it, and whenever I want to use the RFID reader I have to set a LOW signal. The only issue is that it might be dangerous for the device (SD adapter). I'm right? – Pinedo98 Aug 8 '17 at 17:42
  • I think you mean the Chip Select or Slave select to switch LOW when you want to use it. But maybe it helps if you add your sketch and scheme. The adapter contains a voltage regulator for 5->3.3V so that should cause not cause any harm. Switching Vcc too often might do, but I think you mean the CS or SS pin. – Michel Keijzers Aug 8 '17 at 18:19
  • No, I did mean Vcc. Actually I'm powering the SD card with a digital pin that I switch when I want to use it. – Pinedo98 Aug 8 '17 at 18:37
  • Ok ... to preserve power? There might be better ways for that possibly. I don't know happens if you write, the function returns, while writing is not finished and you switch off the power. Check the power consumption when not in use, or otherwise check if it has a sleep mode. Or wait long enough to be sure there is no write active.l – Michel Keijzers Aug 8 '17 at 18:52
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.