Overview
========
The dual_sdcards project is a demonstration program for support 2 sd cards based on the SDK software. It reads/writes
/erases the 2 SD cards individually with polling and blocking mode after detecting and initializing them. 
Remark: The SDMMC card interface supports interface to 2 devices (SD0 and SD1) with the same SDMMC peripheral. 
		Though some registers like power, clock enablement are dedicated for SD0 and SD1, the most parts of the peripheral 
		are shared, like clock source and divider. So, the access process to both devices must be serial not be parallel. It is, 
		a transaction on one device should start after the other completed.
		
Software setup 
==============
Reminder: First, please get the SDK package with midware of SDMMC.  

- Copy the files "fsl_sdif1.c" and "fsl_sdif1.h" under \drivers\ in the sw package to \devices\LPC55S69\drivers\ in the
  LPCXpresso55S69 SDK package.
- Copy the folder "dual_sdcards" in the sw package to \boards\lpcxpresso55s69\demo_apps\ in the LPCXpresso55S69 SDK package.
- Copy the files "fsl_sd1.h" and "fsl_sdmmc_host1.h" under \sdmmc\inc\ in the sw package to \middleware\sdmmc\inc\ in the 
  LPCXpresso55S69 SDK package.
- Copy the files "fsl_sdmmc_host1.c" under \sdmmc\port\sdif\polling\ to \middleware\sdmmc\port\sdif\polling\ in the 
  LPCXpresso55S69 SDK package.
- Copy the file "fsl_sd1.c" under \sdmmc\src to \middleware\sdmmc\src\ in the LPCXpresso55S69 SDK package.
  and add "#include "fsl_sd1.c" at the end of line of the file "fsl_sd.c".

Toolchain supported
===================
- Keil MDK  5.27

Hardware requirements
=====================
- Micro USB cable
- LPCXpresso55s69 board
- Personal Computer
- 2 SD cards
- one more board to support SD card with a card slot (e.g. MCB4300/MCB1800 board)

Board settings
==============
1. Insert the 2 cards individually into card slot
2. Generally, the below related SD1 pins on arduino header on LPCXpresso55s69 board should be connected to another card slot:
   
   <header_no>	   <signal>				<remark>
   
    P16_12			+3.3v				power supply
	P16_16			GND					ground
	P18_2			SD1_CLK				SD/MMC/SDIO clock
	P18_4			SD1_CMD				command input/output
	P18_6			SD1_D0				data 0 for data lines
	P18_8			SD1_D3				data 3 for data lines
	P18_10			SD1_D1				data 1 for data lines
	P18_12			SD1_D2				data 2 for data lines
	P18_19			SD1_CARD_DET		card detect
	P18_17			SD1_PWR_EN			(optional) slot power enable
	
Prepare the Demo
================

1.  Connect a micro USB cable between the PC host and the LPC-Link USB port (P6) on the board.
2.  Open a serial terminal with the following settings:
    - 115200 baud rate
    - 8 data bits
    - No parity
    - One stop bit
    - No flow control
3.  Download the program to the target board.
4.  Reset the SoC and run the demo.

Running the demo
================
When the demo runs successfully, the log would be seen on the terminal like:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/*********************************************************************
           < Dual SD Cards Example (block polling mode) >
*********************************************************************/

Please insert 2 cards individually...
waiting card 0... inserted!

===================Card 0 Information Log====================

Card size = block count: 3911680 * block size: 512 bytes (~2GB)

Working condition:

  Voltage : 3.3V

  Timing mode: High Speed

  Freq : 50000000 HZ
==============================================================
waiting card 1... inserted!

===================Card 1 Information Log====================

Card size = block count: 30597120 * block size: 512 bytes (~15GB)

Working condition:

  Voltage : 3.3V

  Timing mode: High Speed

  Freq : 50000000 HZ

==============================================================

Individually Read/Write/Erase both cards continuously until error occurs......

Card 0 access starting firstly with block mode...

Write/read one data block......
Compare the read/write content......
The read/write content is consistent.
Write/read multiple data blocks......
Compare the read/write content......
The read/write content is consistent.
Erase multiple data blocks......

Card 0 access OK!

Card 1 access starting with block mode...

Write/read one data block......
Compare the read/write content......
The read/write content is consistent.
Write/read multiple data blocks......
Compare the read/write content......
The read/write content is consistent.
Erase multiple data blocks......

Card 1 access OK!

Input 'q' to quit read/write/erase process.
Input other char to read/write/erase data blocks again.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Customization options
=====================

