Module de gestion de cartes MicroSD

published: 10 December 2019 / updated 31 October 2020

Lire cette page en français

 

 

How to use an SD card

The terms SD card stands for “Secure Digital” Card, there are many types of SD cards starting from the RS-MMC big sized ones used in cameras to the micro and mini SD cards that are commonly used in mobile phones, MP3 players etc. Although there are few important differences between all these cards, the underlying working principle is all the same.

The SD cards can work in two operating modes, one is using the SD mode commands and the other is SPI mode. Most of the Digital cameras and mobile phones will use the SD mode to communicate with the SD card, however this is not of our interest because only the SPI mode to communicate between an SD card and a Microcontroller like Arduino (ATmel), PIC, AVR etc.. A simple connection diagram for SPI with a microcontroller shown below:

micro SD card Microcontroller Communication in SPI mode

The SPI communication requires only four wires and is vastly supported by most of the microcontrollers. However the SD card operates with a voltage of 3.3V and all its pins speak with only 3.3V, the Microcontroller on the other hand might work with +5V in those cases a bi-directional logic level shifter (like 74HC245) that can convert the 5V signals to 3.3V is recommended. Once you have interfaced the Card you would have to initialize it and then start communicating with it through the SPI commands, it is not possible to cover the entire process here so you can read through the datasheet below to get more info.

micro sd card pinout
pinpin namefunction
1NCNot used
2CSChip Select
3MOSIMaster-out, Slave-in
4VDDPositive Supply
5CLOCKSerial Clock
6GNDGround
7MISOMaster-in, Slave-out
8NCNot used