Nuvoton 范例
M031_Series_BSP_CMSIS_V3.05.000
SPI_PDMA_LoopTest
main()
.......已经宣告 PDMA
/*=======================================================================
SPI master PDMA TX channel configuration:
-----------------------------------------------------------------------
Word length = 32 bits
Transfer Count = DATA_COUNT
Source = g_au32MasterToSlaveTestPattern
Source Address = Incresing
Destination = SPI0->TX
Destination Address = Fixed
Burst Type = Single Transfer
=========================================================================*/
但是Re-trigger又重新宣告PDMA及SPI输出入等驱动???????
/* Re-trigger */
/* Master PDMA TX channel configuration */
/* Set transfer width (32 bits) and transfer count */
PDMA_SetTransferCnt(PDMA, SPI_MASTER_TX_DMA_CH, PDMA_WIDTH_32, DATA_COUNT);
/* Set request source; set basic mode. */
PDMA_SetTransferMode(PDMA, SPI_MASTER_TX_DMA_CH, PDMA_SPI0_TX, FALSE, 0);
/* Master PDMA RX channel configuration */
/* Set transfer width (32 bits) and transfer count */
PDMA_SetTransferCnt(PDMA, SPI_MASTER_RX_DMA_CH, PDMA_WIDTH_32, DATA_COUNT);
/* Set request source; set basic mode. */
PDMA_SetTransferMode(PDMA, SPI_MASTER_RX_DMA_CH, PDMA_SPI0_RX, FALSE, 0);
/* Enable master's DMA transfer function */
SPI_TRIGGER_TX_PDMA(SPI0);
SPI_TRIGGER_RX_PDMA(SPI0);
|