SD SPI Test Project
--------------------

This project tests the interface to a SD card using SPI mode

As nor the STM32F4 Discovery nor the LAB Board feature a SD Card
reader, a companion board has been developed to connect the card
to the system. It's description can be found on the SD Board directory.

The following lines are used:

MCU   External Port 2 line   SD Card Line      SD Board    Cable color
----  --------------------   ------------     ----------   -----------
PD10  EXT2-1 : Card detect     *Detect           10         Orange
PB15  EXT2-2 : SPI2-MOSI       CMD / Din          3         Yellow + Red
PB13  EXT2-3 : SPI2-SCK        CLK / SCLK         6         Violet
PB14  EXT2-4 : SPI2-MISO       DAT0 / Dout        8         White + Red
PB12  EXT2-5 : NSS             DAT3 / CS          2         Pink
+3V   EXT2-6 : Vdd             VDD                5         Red + Brown
PC6   EXT2-8 : USART6-TX       ---               --         Blue
GND   EXT2-9 : GND             GND                4         Black
PA15  EXT2-11: W Protect       *Write            11         Grey

Most lines connect to the SD Card interface

EXT2-8 (PC6) go to a FTDI TTL-232R-3V3-AJ cable to give debug
messages on a serial console.

Not all cards are usable in SPI mode.
For cards that are not usable in SPI mode an alternative
SDIO mode must be used.

Information about low level card access can be found in:
http://chibios.sourceforge.net/html/group___m_m_c___s_p_i.html

Information about the high level FAT functions can be found in:
C:\STM32v2\ChibiOS_2.6.2\ext\fatfs\doc

This test project is big so it cannot be run from RAM
It also needs Operating System and FAT FS sources compilation.
The Makefile is already configured to be run from FLASH and to recompile 
all the needed source files.



Project Files
--------------

Makefile
Project Makefile configured for Flash operation
Includes links to the FAT Libraries

Base.c Base.h
Main base and start-up files

chconf.h halconf.h mcuconf.h
ChibiOS/RT configuration files

ffconf.h
FAT File System Library configuration file

uart6_tx.c uart6_rx.h
Serial debug module files

sd_spi.c sd_spi.h
Functions needed to operate the SD Card

exceptions.c
File to trap MCU exceptions
It is used to debug exceptions and don't affect normal operation
It can be removed from the project if needed

main.c
Main program that demostrates the use of the SD Card





