Kinetis SDK v.1.2 Demo Applications User's Guide  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
SPI SDCard Example

Overview

The SPI SdCard Example application demonstrates the use of SD card driver with SPI. Provide an example with different modes: (Temporary, this example just don't support SD card memory more than 2 GB)

Supported Platforms

These Freescale Freedom development platforms and Tower System modules are supported by the SPI SdCard example.

System Requirement

Hardware requirements

Toolchain requirements

Software requirements

Getting Started

Hardware settings

The SPI SdCard Example project does not call for any special hardware configurations. Although not required, the recommendation is to leave the development board's jumper settings and configurations in default state when running this example. If there is not any built-in SD-Card slot on the board, TWR-MEM board is required to run this example.

Prepare the example

  1. Connect a USB cable between the PC host and the OpenSDA USB port on the board.
  2. Open a serial terminal with these settings:
    • 115200 baud rate
    • 8 data bits
    • No parity
    • One stop bit
    • No flow control
  3. Download the program to the target board.
  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the example.

Run the example

Ensure that the card doesn't contain any important content because the demo will erase and overwrite some sectors.

These instructions are displayed/shown on the terminal window:

SPI SD Card Demo Start!
BaudRate set to 375000Hz
BaudRate set to 20000000Hz
------- Card Information -------
Card Type: SDSC
Card Capacity: 1.97 GB
-------- Card CID --------
Manufacturer ID: 0x2
OEM ID: 0x544D
Product name: SA02G
Product revision: 0.5
Product serial number: 0x2080728A
Manufacturing data: Aug 2010
-------- Card CSD --------
CSD Structure: 0x0
taac: 2000.00 us
nsac: 0 clks
tran speed: 25000000.00 kbps
ccc: class 0 2 4 5 7 8 10
max read block length: 1024 Bytes
max write block length: 1024 Bytes
Support partial read
Support crossing physical block boundaries reading is allowed
VDD_R_CURR_MIN: 0x7
VDD_R_CURR_MAX: 0x1
VDD_W_CURR_MIN: 0x7
VDD_W_CURR_MAX: 0x3F
c_size_mult: 7
c_size: 3763
Erase unit size is one or multiple units of 512 bytes
The size of write protected group is 2 blocks
R2W_Factor: 2
Hard disk-like file system with partition table
Start read/write example...
Single block read/write example passed!
Writing 4096 bytes for 100 times in 2502 ms, at 163 kB/s
Reading 4096 bytes for 100 times in 2164 ms, at 189 kB/s
Multi-block read/write example passed!
SPI SD Card Demo End!