10

I need to add a second SD card reader to my Raspberry Pi for the project www.samplerbox.org (the RPi will be embedded in a box, so I need a user-SD-card reader).

Here is what I would like to use:

enter image description here

How to wire this to the RaspberryPi? Via GPIO? (if so, how?) Via USB port? (if so, how to wire these pins to a standard USB plug?)

UPDATE : Here are the 2 * 8 pins : GND, 3V3, 5V, CS, MOSI, SCK, MISO, GND :

enter image description here

  • Do you plan to boot from the external SD card? Or is the Pi to boot from the internal SD card. What will the external SD card be used for? – joan Mar 13 '15 at 16:27
  • @joan No I don't plan to boot on it, the external SD card will be there to let the user load/save some data. The user won't acess to the internal SD card (RPi embedded in a box). Easier to understand with a picture : www.samplerbox.org – Basj Mar 13 '15 at 16:30
  • 1
    You can save yourself a lot of trouble if you just give the user a USB stick for data. Implementing a second SD card interface will be very difficult. Just bring a USB port out to the outside of your box. – joan Mar 13 '15 at 16:35
  • 1
    You further can use a SDCard to USB adapter, which is a tradeoff between both. Just google SDCard USB adapter. – user236012 Mar 13 '15 at 17:08
  • 4
    While I agree it may be easier to use a USB stick, it should not be difficult to interface a SD Card. All SD support SPI and run on 3.3V (many of these boards have level converters to interface to 5V). I have used a similar adapter on Arduino, and am going to try on Pi. There is FAT software for Arduino. (NOTE I don't expect to access it via standard kernel drivers.) – Milliways Mar 13 '15 at 23:32
5

It seems like it is a SPI device. You should first need to enable SPI using raspi-config. Then you'll need to wire:

(Reader) GND  --  GND       (GPIO-Raspberry Pi2) 
         3V3  --  3.3 V (Pin 1)
         5V   --  NC
         CS   --  GPIO8 (Pin24)
         MOSI --  GPIO10 (Pin 19)
         SCK  --  GPIO11 (Pin 23)
         MISO --  GPIO9 (Pin 21)
         GND  -- NC
  • 2
    Any idea about how to have better transfer rate than 1 megabyte / sec with such technique? Is there another way than USB SD reader that can allow 10 MB/sec ? – Basj Mar 6 '16 at 9:40
  • high speeds are about more than one line for a SD card data, it seems you don't have them here, and it's not a simple-wiring setup over SPI interface – Alexey Vesnin May 26 '16 at 2:11
6

Raspberry pi pinout

You should connect GND, 5V and 3V3 to the appropriate pins on the pi. Then MOSI and MISO are also marked in the picture, SCK should connect to SCLK (this is the 10MHz clock which should be driven by the pi) and finally connect the CS pin to CS0 (Chip-Select, so you can connect 2 SD or other SPI-compliant devices).

According to the first reply on this thread, if you're running kernel version greater than 3.2.20 it should support the SPI hardware on the board and should give you 1MB/s throughput with little CPU load, which is impressive.

If your kernel is of a higher version but is compiled without SPI device support you should recompile it with an appropriate configuration (see the mentioned thread again).

  • 2
    Thanks for this answer! But 1 MB/s is far too low (compared to a USB reader), and for my project, I need to load 100MB in a very short time (this is possible from RPi microSD reader, possible from a USB SD card reader, so I need the same from this PCB SD reader) – Basj Mar 30 '15 at 6:58
  • You won't see a faster rate with this SD reader and the pi combination. 1MB/s is achieved utilizing the specialized SPI interface hardware on the pi. If you use any other GPIO connectors you'll have to implement it with the CPU, achieving far lower rates, around 180KB/s. If you need faster rates, use a USB reader as others suggested, which as I recall got me around 4MB/s but maybe others can give more precise numbers. – Yigal Mar 30 '15 at 9:43
  • 1
    Arghh... So sad we can't get more than 1MB/s with this reader. Is it possible to turn this reader into a USB SD reader (with additionnal components?) – Basj Mar 30 '15 at 10:37
  • 1
    You can get a module that handles SPI (and other protocols) to USB like thie one for about $20: digikey.co.il/product-search/en?v=768&mpart=VA800A-SPI But I wouldn't go that way. I didn't read the spec so I don't know if the module identifies itself as Mass Storage class, or some other more generic USB class in which case you'll need to wrap it with your own driver. It'll be MUCH easier to get a simple USB SD card reader. – Yigal Mar 30 '15 at 19:43
  • 1
    Sure, but I need a USB SD card reader that can be mounted on PCB (not only for me, but my project samplerbox.org will be opensource, so I want that it's easy for anyone to source the components) – Basj Mar 30 '15 at 20:54
1

Without knowing much about the card reader itself, I will give the best answer I can.

The reader seems to have markings on it next to the GPIO pins. Connect them to the corresponding pins on the RPI using some female-female jumper cables (or a more permanent method for your application). If they do not have a corresponding pin, attach them to a free pin on the pi and take note of it.

The API for the reader may need some extra configuring to allow file transfer through the other pins, but I cannot help you with this part.

Hopefully this should work!

  • I added the pins labels and photo in the question. Is it possible to go from these pins to GPIO or to USB ? – Basj Mar 29 '15 at 18:51
1

An excellent blog post tutorial has been posted here:

http://blogsmayan.blogspot.com/p/interfacing-sd-card.html

Please review that detailed posting for a complete answer to connecting your SD card reader to the Pi.

There is a companion You Tube video available here:

https://www.youtube.com/watch?v=ihqXzQgaIaw

  • Cool article indeed. I just looked quickly, is there something about transfer rate @Kolban ? – Basj Jul 28 '17 at 22:42
0

Based on your description of your need and visiting your project page, an alternative would be to make your RPi boot off a USB stick and use the internal card reader to accept cards from the user.

  • Thank you for your answer. It could be an idea, we need to think about it. Inserting/removing the microSD card might be too small / difficult for an every day use. For my project, I need it to be as handy as inserting/removing a SD card from a digital camera. I'll think about it... PS: could you add a link about "how to boot off a USB stick" on a RPi in your answer, for future reference? – Basj Jul 12 '18 at 7:50

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.