/******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
* File Name          : Readme.txt
* Author             : MCD Application Team
* Date First Issued  : 05/21/2007
* Description        : Description of the DMA Example3.
********************************************************************************
* History:
* 05/21/2007: V0.3
********************************************************************************
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*******************************************************************************/

Example description
===================
This example provides a description of how to use four DMA channels to transfer a 
data buffer from memory to SPI2 through SPI1 and a second data buffer from memory
to SPI1 through SPI2 in ful-duplex mode.
Two DMA channels are used for SPI1 Tx and Rx transfers and the other two DMA channels 
are used for SPI2 Tx and Rx transfers.
Both SPIs are configured with 8bit data frame and a 4.5Mbit/s communication speed.
The data buffer SPI1_Buffer_Tx to be sent is transfered to SPI1 DR register through 
DMA channel3 on Tx request which is generated when the SPI1 DR regsister is empty.
The hardware connection between the two SPIs, permit the data transmission
from SPI1 to SPI2. Once a data is received on the SPI2 DR register, an Rx request is 
generated and the DMA channel4 store the received data in the SPI2_Buffer_Rx.
Since the two SPIs are configured in full-duplex mode, the two data buffer are transfered 
in the same time. The data buffer SPI2_Buffer_Tx to be sent is transfered to SPI2 DR 
register through DMA channel5 on Tx request which is generated when the SPI2 DR regsister
is empty. The hardware connection between the two SPIs, permit the data transmission
from SPI2 to SPI1. Once a data is received on the SPI1 DR register, an Rx request is 
generated and the DMA channel2 store the received data in the SPI1_Buffer_Rx. 
The end of both DMA channels transfers is detected by cheking their respective DMA 
transfer complete flag.
The CRC calculation is enabled, to check the correctness of the transmitted data. 
the calculated master and slave CRC values are transmitted automatically at the end 
of buffer transfer through DMA. The comparison is automatically done and the CRC error
flag is set in case of error. the received CRC values are respectively stored in 
SPI1_CRC_Value for SPI1 and SPI2_CRC_Value for SPI2.
TransferStatus1 and TransferStatus2 gives the data transfer status for both transfer 
direction, where they are PASSED if transmitted and received data are the same otherwise 
the transfer is FAILED 


Directory contents
==================
stm32f10x_conf.h  Library Configuration file
stm32f10x_it.c    Interrupt handlers
stm32f10x_it.h    Interrupt handlers header file
main.c            Main program


Hardware environment
====================
 - Connect SPI1 SCK pin (PA.05) to SPI2 SCK pin	(PB.13)
 - Connect SPI1 MISO pin (PA.06) to SPI2 MISO pin (PB.14)
 - Connect SPI1 MOSI pin (PA.07) to SPI2 MOSI pin (PB.15)
      

How to use it
=============
In order to make the program work, you must do the following :
- Create a project and setup all your toolchain's start-up files
- Compile the directory content files and required Library files :
  + stm32f10x_lib.c
  + stm32f10x_dma.c
  + stm32f10x_rcc.c
  + stm32f10x_spi.c
  + stm32f10x_nvic.c
  + stm32f10x_gpio.c
  + stm32f10x_flash.c
    
- Link all compiled files and load your image into either RAM or FLASH
- Run the example


******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE******
