You Are Here: Home » AVR ATmega Projects » Memory - Storage Projects » Interfacing SD Card with AVR Microcontroller

Interfacing SD Card with AVR Microcontroller




This project explains how to interface the SD card with an AVR microcontroller. In this project an ATMEGA16 microcontroller is used. The microcontroller runs on 5V power supply with a built in crystal frequency of 8 MHz. A 2GB SDSC card from Transcend is used in this particular project, but the code will work with most of the SD cards. The SD card is formatted with FAT32. The ultimate aim of this project is to read a file from the FAT32 file system of the SD card.

Interfacing SD Card with AVR Microcontroller

The SD card has been formatted as FAT32 before interfacing. The generalized code for the FAT32 is written to interface the SD card. Explanations of the FAT32 file system and how to access files from these file system is explained in this project.

The following section explains the SD card working in detail.

This project explains how to interface the SD card with an AVR microcontroller. In this project an ATMEGA16 microcontroller is used. The microcontroller runs on 5V power supply with a built in crystal frequency of 8 MHz. A 2GB SDSC card from Transcend is used in this particular project, but the code will work with most of the SD cards. The SD card is formatted with FAT32. The ultimate aim of this project is to read a file from the FAT32 file system of the SD card.

The SD card has been formatted as FAT32 before interfacing. The generalized code for the FAT32 is written to interface the SD card. Explanations of the FAT32 file system and how to access files from these file system is explained in this project.

The following section explains the SD card working in detail.

SD CARD

The SD card is consisting of two basic semiconductor sections, a ‘memory core’ and a ‘SD card controller’.

The ‘memory core’ is the flash memory region where the actual data of the file is saved. When we format the SD card a file system will be written into this region. Hence this is the region where the file system exists.

The ‘SD card controller’ helps to communicate the ‘memory core’ with the external devices like microcontrollers. It can respond to certain set of standard SD commands and read or write data from the memory core in for the external device.

The capacity of the ‘memory core’ is referred to as the size of the SD card. Other than the ‘memory core’ there are certain registers associated with the ‘SD card controller’. These registers store the status of the SD card. The contents of these registers are read only.

Interfacing SD Card with AVR Microcontroller schematic

The SD card can be interfaced with the microcontroller using serial data bus. It can connect using ‘SD buses’ or ‘SPI buses’. The ‘SD bus’ is designed for high speed whereas the SPI bus can operate with much lower speed only. The microcontroller can read or write data the memory core and read the registers using standard SD commands send through these serial buses.

In this project the memory card is interfaced using the SPI bus. Certain commands are not available for the SPI mode of interfacing and also the speed will be lower than the SD mode. But this kind of interfacing is a lot simpler especially due to the fact that most of the microcontroller has built in SPI hardware module.

This section summarizes that the SD card has an internal controller chip, a memory core region. The internal controller can decode the commands, provide serial interface while the memory core region is where the file system is implemented.

Based on this knowledge the following section tries to explain the SD card functional layer concept.

 

For more detail: Interfacing SD Card with AVR Microcontroller

Leave a Comment

You must be logged in to post a comment.

Read previous post:
Microneedle patch delivers localized cancer immunotherapy to melanoma

Biomedical engineering researchers at North Carolina State University and the University of North Carolina at Chapel Hill have developed a...

Close
Scroll to top