Interfacing with a Secure Digital (SD) card

From Mech
Jump to navigationJump to search

Original Assignment

Establish SPI communication between your PIC and a Secure Digital (SD) card for data logging. Demonstrate the ability to store data on the card and to read it back later.

Overview

Secure Digital Cards, or SD cards, are used to hold information in many common electronic devices from digital cameras to mobile phones and come in sizes as small as 16-32 MB and as large as 8 GB. In this lab, we will establish communication between a Microchip PIC 18F4520 and a 2GB SD card manufactured by Apacer.


Most SD cards can only support clock rates up to 25 MHz, and voltage ranges from 2.0 – 3.6 v. It’s important to limit the clock signal from the PIC to the card to this range. SD Cards can operate in two modes – SD and SPI, with the latter being appropriate for use with microcontrollers. To learn more about SPI protocol, go here. Only 7 of the 9 pins on the card are actually used in SPI mode – pins 8 and 9 are reserved and should be connected to a pull-up resistor.