1、功能说明

    此例程提供了一种DMA外设到外设模式单块传输的用法。SPI1作为源外设，USART1作为目的外设。

    通过SPI1（作主机）将wBuffer中的数据（DMA (P2P) task: W25Q128 sFLASH to USART (SPI to USRAT)）作为源数据写入SPI FLASH模块；

    配置DMA1，通道0，开启源硬件握手和目的硬件握手，设置源硬件握手号和目的硬件握手号；配置源DMAMUX通道号及请求，配置目的DMAMUX通道号及请求；

    开启通道0的DMA传输完成中断（IntTfr中断），用于指示传输已完成；

    配置SPI1为双线只读模式，SPI1接收来自SPI FLASH模块的数据，触发源外设通道的DMA请求；开启USART1的Tx DMA功能，触发目的外设通道的DMA请求，即开始SPI1至USART1的DMA传输；

    等待数据传输完成，串口打印“DMA (P2P) task: W25Q128 sFLASH to USART (SPI to USRAT)”，即表示传输无误。


2、使用环境

    软件环境：
        KEIL MDK-ARM 5.34.0
        IAR EWARM 8.50.1
    
    芯片支持：
        N32H730  
        N32H735   
        N32H735EC
        N32H760
        N32H762
        N32H765
        N32H765EC
        N32H785
        N32H785EC
        N32H787


3、使用说明
    
    1、时钟源：HSI+PLL

    2、系统时钟：
        M7核：600MHz

    3、DMA通道：DMA1_CH0
    
    4、USART1配置：
        TX  -->  PA9            AF_PP
        波特率：115200
        数据位：8bit
        停止位：1bit
        无校验

    5、SPI配置：
        NSS--PA4（接sFLASH的NSS）、SCK--PA5（接sFLASH的SCK）、MISO--PA6（接sFLASH的SIO1/DO）、MOSI--PA7（接sFLASH的SIO0/DI） 

    6、使用方法：
        a，编译下载代码复位运行
        b，通过串口调试助手查看打印信息，验证结果

4、注意事项
    外设到外设模式，源和目的都需要配置硬件握手接口；源和目的都需要配置一个DMAMUX通道，且硬件握手接口号必须与DMAMUX通道号一一对应。


1. Function description

    This demo provides a use of DMA peripheral-to-peripheral mode Single-block transfer. SPI1 as the source peripheral, USART1 as the destination peripheral.

    The data in wBuffer (DMA (P2P) task: W25Q128 sFLASH to USART (SPI to USRAT)) is written to SPI FLASH module as source data through SPI1 (as master).

    Configure DMA1, channel 0, enable source hardware handshake and destination hardware handshake, set the source hardware handshake number and destination hardware handshake number; configure the source DMAMUX channel number and request, configure the destination DMAMUX channel number and request.

    Enable the DMA transfer completion interrupt (IntTfr interrupt) for channel 0 to indicate that the transfer has been completed.

    Set SPI1 to dual-line read-only mode. SPI1 receives data from SPI FLASH module and trigger the DMA request of the source peripheral channel. Enable the Tx DMA function of USART1, trigger the DMA request of the destination peripheral channel, that is, start the DMA transmission from SPI1 to USART1.

    Wait for the data transfer to complete, the serial port displays "DMA (P2P) task: W25Q128 sFLASH to USART (SPI to USRAT)", indicating that the transmission is correct.

    
2. Development environment

    Software environment:
        KEIL MDK-ARM 5.34.0
        IAR EWARM 8.50.1
    
    Supported chips:
        N32H730  
        N32H735   
        N32H735EC
        N32H760
        N32H762
        N32H765
        N32H765EC
        N32H785
        N32H785EC
        N32H787

3. How to use

    1. Clock source: HSI+PLL

    2. System clock:
        M7 core: 600MHz

    3. DMA channel: DMA1_CH0

    4. USART1 configuration: 
        TX --> PA9	AF_PP
        Baud rate: 115200
        Data bit: 8 bits
        Stop bit: 1bit
        No check

    5. SPI configuration:
        NSS--PA4 (NSS connected to sFLASH), SCK--PA5 (SCK connected to sFLASH), MISO--PA6 (SIO1/DO connected to sFLASH), MOSI--PA7 (SIO0/DI connected to sFLASH)

    6. Usage:
        a. Compile download code reset run
        b. Check the printed information and verify the results through the serial debugging assistant

4. Attention
    In peripheral-to-peripheral mode, both the source and destination need to be configured with a hardware handshake interface; both the source and destination need to be configured with a DMAMUX channel, and the hardware handshake interface number must correspond one-to-one with the DMAMUX channel number.

