The SD card interface technology is rapidly expanding since its introduction in the beginning of this century. The standards defined time by time by SD Association are even more, rapidly increasing transfer speed and memory size. A quick tour of the current standards is available on Wikipedia. Deeper descriptions can be found in the SD Association documents linked below.
The Roadrunner SOM uses a Microchip SAMA5D27 MCU. As described on SAMA5D2 Series datasheet it has two Secure Digital MultiMedia Card Controllers (SDMMC), with some little differences between them. Further SD cards can be used also with SPI connections.
The complete list of supported standards is available on chapter 51 of the datasheet. This list can significantly change from MCU to MCU. The corresponding datasheet must be consulted to know which SD card can be used with each specific MCU. The Roadrunner complies with standards up to SDXC UHS-I for SDMMC0 controller and up to SDXC High Speed for SDMMC1, accepting all the capacities currently available.
Once again we are talking about the physical part of the circuit, the connection between the SDMMC peripheral and the SD card socket.
As explained in the SAMA5D2 Series datasheet
22.214.171.124 SDCard / e.MMC Boot
The SDCard/e.MMC boot requires the Card Detect pin to be connected. If the level on the Card Detect pin is low, SDCard/e.MMC access is initiated (IOs toggling). If not, no communication with SDCard/e.MMC is performed (no IOs toggling).
So the SDMMCx_CD pin should be used by pulling it down or by connecting it to the specific Card Detect contact of the socket.
This is an example for a 4-bit connection from SDMMC peripheral to the SD card socket. Data [3..0], Clock and Command signals are used.
The SD card socket is exposed to the external world. Even if not connected with any other device it can suffer by the electrostatic charges accumulated in a human body and discharged to the shield when the fingers touch it. As a usual precaution, some filtering must be applied to avoid both radiated and conducted emissions in order to comply to the EMC specification. Furthermore, the SD card specifications impose pull−up and series impedance matching resistors. Fortunately, as often happens when a device is so commonly spread in mobile equipments, it already exists a chip that implements all of those functions at a time. The CM1624 is a combination EMI filter and line termination device with integrated TVS diodes for use on T-Flash/MicroSD interfaces.
The filesystem stored in the SD card can be corrupted when the power supply voltage is below of a specific threshold. An easy way to protect all the devices, included MCU and SD card, is to tie the reset line for all of them to a Power Supply Supervisor as the CAT811 chip. The reset signal is asserted LOW when the power supply voltage falls below the threshold trip voltage and remains asserted for at least 140 ms after the power supply voltage has risen above the threshold. For the CAT811T version the Nominal Threshold Voltage is 3.08V. The power supply for the SD card can be managed with a circuit like the one depicted below with the supervisor reset control connected to the N mosfet gate.
This is an example of an SD card used in SPI mode with the MISO, MOSI, clock and chip select signals connected according to the SD Association specifications. Let's just evidence the filter applied on the clock line to improve the EMC in a very hard environment.
In both 4-bit or SPI mode the tracks carry data and clock signals at an high data rate. In order to avoid glitches, the propagation time must be contemplated, ensuring that all the data are stable at the interface before the clock triggers the reading or writing. The signals path lenght of all data signals must be length matched within some tenths of mm and the clock must be something like 1mm longer. This can be done with the tool already described in article regarding ethernet. To avoid crosstalking those tracks must be kept each with a good ground plane around and below, also connecting the layers with a sufficient number of vias.
The following PCB routing corresponds to the schematics example 1
Resulting in this copper top layer
This PCB rounting corresponds to the schematics example 3 with a vertical type socket.
Here some examples, not exhaustive at all, of SD card sockets.
This is the classic push-push socket, very good for frequently changing the card.
MSD-HOLDER-1 - Micro SD holder push-push type
1.10mm pitch microSD memory holder push-push type
The hinge socket needs to be unlocked to extract the SD card. More suitable for shock resistant installation with rare removal.
MSD-HOLDER-2 - Micro SD holder hinge type
1.10mm pitch microSD memory holder, hinge Type,
The vertical, push-pull socket has a very small footprint on the PCB. It's perfect for managing the card from the top side when no other side is accessible.
MSD-HOLDER-3 - Micro SD holder vertical type
Micro SD holder vertical type