Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
SD/MMC Card Example

Purpose

This example demonstrates basic functions of SD/MMC stack. It will read and write an SD/MMC card over MCI or SPI interface. It is a development base for a specific SD/MMC application which does not require a file system.

Description

The example executes the following sequences:

  • For each card slot available on board:
    • Wait for a card insertion
    • Initialize an SD/MMC card.
    • If the inserted card is an SD or MMC card, test read/write access.
      • Write data into the card
      • Read data from the card
      • Verify the written data.

The example outputs the information through the standard output (stdio). To know the output used on the board, look in the conf_example.h file and connect a terminal to the correct stdio port.

While using Xplained Pro evaluation kits, please attach I/O1 Xplained Pro extension board to EXT1.

Usage

  1. Build the program and download it into the board.
  2. On the computer, open and configure a terminal application. Refer to conf_example.h file.
  3. Start the application.
  4. In the terminal window, the following text should appear:
    * -- SD/MMC Card Example --
    * -- Compiled: xxx xx xxxx xx:xx:xx --
    * Please plug an SD/MMC card in slot 1.
    * !!Warning, the data contained will be lost!!
    *
  5. If the inserted card is a SD or MMC card, the following text should appear: A card has been connected. Card information: xxxx xxxx MB Write pattern... XXXXKBps [OK] Read... XXXXKBps [OK] Read and check pattern... [OK] Test finished, please unplugged card.