SD card 1 - FPGA connection
SD cards are easily interfaceable with FPGAs. They come in different sizes (standard, mini and micro) but electrically they all work the same way. Let's focus on micro-SD cards since they are conveniently small and popular nowadays.
Micro-SD cards have 8 pins. First the power connection goes on pins 4 and 6.

Then, you need between three and six connections to FPGA pins depending on the mode of operation you decide to use.

SPI mode
In SPI mode, the DI/DO lines are unidirectional. That means:
- No pull-up necessary on DI/DO
- Commands (and sector data when you do a sector write) are sent to the DI pin
- Responses (and sector data when you do a sector read) are received from the DO pin

The SPI mode is often used in microcontroller systems. With an FPGA, we might be better served with the...
SD modes
In SD modes, the CMD/DATx lines are bidirectional. That means:
- Pull-ups are required on CMD/DATx (FPGAs can usually provide them internally)
- Commands/response are sent/received on the CMD pin
- Sector data (for sector reads and writes) are sent/received on the DATx pins
So for example, we need these connections in SD one-bit mode:
