MG32F10x Standard Peripherals Firmware Library
|
*************** (C) COPYRIGHT 2020 - 2023 megawin Technology *************** * @file SPI/QSPI_Master_DMA/readme.txt * @author megawin Application Team * @version V0.1.10 * @date 05-January-2023 * @brief Description of the SPI QSPI_Master_DMA example. ****************************************************************************** * THE PRESENT FIRMWARE 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, MEGAWIN SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM * THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. ******************************************************************************
This example and SPIS1_Slave_DMA example describe how to realize the communication between SPI master and SPI slave using DMA.
In this example, Main clock is from PLL clock and it is configured at 96MHz. The PLL clock is based on 8MHz HSE. APB1 and APB2 clock is from Main clock.
To use this example, you need to prepare two MG32 boards (let's call them BoardA and BoardB) then connect these two boards through SPI lines and GND.
In addition, connect the UART1 of the two boards to the PC to realize the communication with the board.
The BoardA needs to download the QSPI_Master_DMA program, and the BoardB needs to download the SPIS1_Slave_DMA program.
*------------------------------------------------------------------------------* | BoardA BoardB | | ____________________ ____________________ | | | | | | | | | __________ | | __________ | | | | | |____|_______NSS_______|____| | | | | | |SPI Master|____|_______SCK_______|____|SPI Slave | | | | | | Device |____|_______MOSI______|____| Device | | | | | |__________|____|_______MISO______|____|__________| | | | | | | | | | | | | | | | | GND O--|-----------------|--O GND | | | | | | | | | | | | | | | | UART1 | | UART1 | | | |____________________| |____________________| | | | *------------------------------------------------------------------------------*
In QSPI_Master_DMA program, QSPI peripheral is configured as Master full duplex with DMA,and the bit rate is configured as 12 Mbit/s.
In SPIS1_Slave_DMA program, SPIS1 peripheral is configured as Slave Full duplex with DMA.
When the two boards are powered, they will print relevant information through the UART1 and wait for input signal from the UART1 before continuing to run.
Frist,Input any character into the UART1 of BoardB (SPI slave) to make BoardB continue to run.
Then,Then input any character into the UART1 of BoardA (SPI master) to make BoardA start to initiate transmission.
When the transmission is complete, both BoardA and BoardB will print out the data they received.
In order to make the program work, you must do the following :
Run the example