Tuesday, July 28, 2009

SD/MMC Card interfacing with Microcontroller Circuit Project

SD/MMC Card interfacing with MUC with AVR Microcontrollers
Interfacing with ATMega 162:

It is easy to interface a MMC (Multimedia Card) with an Atmel ATmega162 (AVR series) via the SPI (Serial Port Interface). The MMC is connected to the SPI pins of the ATmega16 via simple resistor voltage dividers to transform the +5V high levels to about 3.3V used by the MMC. If the Atmega-162 is working on 3.3 V power supply then all the MMC pins can be directly connected to Microcontroller (as in this design). The data-out pin from the MMC goes directly to the ATmega162, because 3.3V is high for the ATmega162 anyway. The schematic of the MMC interfacing is given below.


Microcontroller board with Ethernet, MMC/SD card interface and USB
Hardware components already integrated on the reference design include:
• Atmel ATmega128 RISC microcontroller with standard 10-pin ISP header
• 64 kByte of external SRAM
• USB <-> RS232 interface
• SD/MMC socket
• Ethernet interface with ENC28J60 (IEEE 802.3, 10Base-T)
The hardware design is expandable by connecting additional components to the existing pin header. Several digitial I/Os, A/D inputs as well as the standard SPI and I2C (TWI) serial interfaces are available for user-defined purposes.
The curcuit board is designed as a two-layer board of size 100mm x 80mm. Most components use SMD packages.


SD/MMC Interface Integration Guidelines
SD/MMC cards provide a low cost solution for data logging and storage applications
for embedded systems. SD/MMC cards can be easily interfaced with a
Microcontroller using an SPI interface and between one and three control lines. While
the electrical interface is relatively straight forward, successfully implementing a
solution can be time consuming for the initial implementation. This document looks at
some of the common pitfalls encountered. The document assumes the developer is
implementing Brush Electronics SD/MMC File System drivers or Utilities with a
Microchip PIC Microcontroller however the principles apply to other implementations.


MMC/SD Card interfacing and FAT16 Filesystem with 8051/8052


# Interface to Chan’s Library of functions

# Target development platform

# Setting up the SPI port during startup.A51

# Global type definitions and variables

# Basic SPI function

1. Transferring & Receiving single byte over SPI Bus
2. SPI Chip Select
3. Setting frequency for SPI Clock
4. Sending command to SD Card
5. Reading response from SD Card
6. Delay and Time function

# SD Card Initialization

1. Setting up the card for SPI Communication

# Reading and Writing a single sector

# Working with diskio.c

# Pulling it all together


Relate Posts