Understanding the SD Card Slot

I created these notes to help better understand the SD Card Slot and significance of its pins. It also contributes towards an understanding of the schematic. Feel free to suggest changes.

The SD Socket

The SD card socket has 4 pads on the metal shielding and 11 pinouts (also pads, at the back). An online search reveals that the pinouts of these components are fairly standard. That’s understandable given the fungible / standardized nature of the cards themselves.

Many of the pins simply connect directly through to the pads of the SD card itself. So let’s consider those:

  1. DAT3 / CS
  2. CMD / DI
  3. VSS1
  4. VCC
  5. CLK / SCLK
  6. VSS2
  7. DAT0 / DO
  8. DAT1
  9. DAT2

The very small microSD cards have only 8 pins. On those there is only one VSS pin.

To these, the SD card slot adds three pins:

  1. Card Detect (CD)
  2. Common Switch
  3. Write Protect (WP)

Note: only eight of the pins are used in this project.

Power Pins

Pins VSS1, VSS2 and VCC relate to power supply.

  1. VSS stands for voltage source and is where ground should be connected. On other schematics it may be labelled as GND.
  2. VDD stands for voltage drain and is where positive power should be connected. On other schematics it may be labelled as VCC, which stands for voltage collector.

Data Pins

SD cards can be operated in SPI (serial peripheral interface) mode or native operating mode. Because the SD card can be attached to most microcontrollers via a generic SPI interface or some GPIO ports it is a suitable for many projects. Therefore we will discuss pins as they are used in this mode.

The SPI protocol defines a host and slave relationship, described at http://elm-chan.org/docs/spi_e.html. This is important to remember in the reading of the pins below. Also, throughout these notes I use the terms host and microcontroller interchangeably.

  1. DAT3 / CS

This is the Data 3 pin in native mode and Chip Select pin in SPI mode. It is used by the SPI host (in our case, the microcontroller) to indicate that it’s communicating with the slave. It can also be used by the slave to indicate to the host it is ready to communicate.

This functionality means the data out and data in pins can be part of a shared data bus (with other SPI slave devices on it).

  1. CMD / DI

This is the Command pin in native mode and Data In pin in SPI mode. It is used by the SPI host to send serial data (bit by bit) to the SD card (the slave) and is sometimes referred to as Master-Out Slave-In (MOSI).

  1. DAT0 / DO

This is the Data 0 pin in native mode and Data Out pin in SPI mode. It is used by the SPI slave to send serial data (bit by bit) to its host (the microcontroller) and is sometimes referred to as Master-In Slave-Out (MISO).

  1. CLK / SCLK

This is the Clock pin in both modes. It is used by the SPI host to provide a clock pulse for the purposes of sending and receiving data on the DI and DO pins.

Card Slot Pins

  1. Card Detect (CD)

This pin is used to detect whether a card has been inserted in the slot. The mechanism by which this is done seems common across slot models (based on a random sampling of datasheets available online): the pin is connected to a mechanical switch which closes when the card is inserted and connects to ground on the other side. On the one we are using, the switch mechanism is exposed and clearly visible on the top of the slot (in the cut-away section of the shielding). Insert a card and you will see how the bent piece of metal (part of the shielding) touches another piece of metal. You can use a multimeter to test that the second piece of metal is connected to the CD pin and the bent piece (and indeed the entire shielding) is connected to ground.

To use the card detect functionality you would connect the CD pin to a positive power rail via a pull-up resistor so that you get a high signal when the slot is empty and a low signal when a card is inserted. This functionality is not used in this project.

This pin is also connected to the Common pin when a card is inserted and disconnected from the Common pin when there is no card inserted. This is an alternative way of using the pin.

  1. Write Protect (WP)

This pin is used to detect whether an inserted card has got Write Protect enabled. As with the CD pin, this is connected to ground when a card is inserted Write Protect on and you would need to have it pulled-up in order to use it.

As with the CD pin, this pin is connected to the Common pin when Write Protect is inserted and otherwise disconnected from the Common pin.

  1. Common Switch

Both the CD and WP pins above are connected to this pin, in addition to ground, when they are activated, providing another way for us to implement that functionality.


Wow Mike,

That is really great! :smile:

You really did some extra work and research here. You’ll get a couple of badges - it’s because of people like you that this project keeps getting better every day. THANK YOU! :pray:


1 Like