#define U3_DMA_SEND_CH DMA_CH5
#define U3_DMA_RECV_CH DMA_CH6
uint8_t u3_send_buff[20]={0};
uint8_t u3_recv_buff[20]={0};
DMA_InitType DMA_UART_TYPE;
DMA_DeInit(U3_DMA_SEND_CH);
DMA_UART_TYPE.BufSize=50;
DMA_UART_TYPE.CircularMode=DMA_MODE_NORMAL;
DMA_UART_TYPE.Direction=DMA_DIR_PERIPH_DST;
DMA_UART_TYPE.DMA_MemoryInc=DMA_MEM_INC_ENABLE;
DMA_UART_TYPE.Mem2Mem=DMA_M2M_DISABLE;
DMA_UART_TYPE.MemAddr=(uint32_t)u3_send_buff; //
DMA_UART_TYPE.MemDataSize=DMA_MemoryDataSize_Byte;
DMA_UART_TYPE.PeriphAddr=(u32)&(USART3->DAT);
DMA_UART_TYPE.PeriphDataSize=DMA_PERIPH_DATA_SIZE_BYTE;
DMA_UART_TYPE.PeriphInc=DMA_PERIPH_INC_DISABLE;
DMA_UART_TYPE.Priority=DMA_PRIORITY_VERY_HIGH;
DMA_Init(U3_DMA_SEND_CH,&DMA_UART_TYPE);
DMA_RequestRemap(DMA_REMAP_USART3_TX, DMA, U3_DMA_SEND_CH, ENABLE);
DMA_SetCurrDataCounter(U3_DMA_SEND_CH,20);
DMA_EnableChannel(U3_DMA_SEND_CH, ENABLE);
DMA_InitType DMA_UART_TYPE_1;
DMA_DeInit(U3_DMA_RECV_CH);
DMA_UART_TYPE_1.BufSize=50;
DMA_UART_TYPE_1.CircularMode=DMA_MODE_NORMAL;
DMA_UART_TYPE_1.Direction=DMA_DIR_PERIPH_SRC; //从外设到寄存器
DMA_UART_TYPE_1.DMA_MemoryInc=DMA_MEM_INC_ENABLE;
DMA_UART_TYPE_1.Mem2Mem=DMA_M2M_DISABLE;
DMA_UART_TYPE_1.MemAddr=(uint32_t)u3_recv_buff; //
DMA_UART_TYPE_1.MemDataSize=DMA_MemoryDataSize_Byte;
DMA_UART_TYPE_1.PeriphAddr=(u32)&(USART3->DAT);
DMA_UART_TYPE_1.PeriphDataSize=DMA_PERIPH_DATA_SIZE_BYTE;
DMA_UART_TYPE_1.PeriphInc=DMA_PERIPH_INC_DISABLE;
DMA_UART_TYPE_1.Priority=DMA_PRIORITY_VERY_HIGH;
DMA_Init(U3_DMA_RECV_CH,&DMA_UART_TYPE_1);
DMA_RequestRemap(DMA_REMAP_USART3_RX, DMA, U3_DMA_RECV_CH, ENABLE);
USART_EnableDMA(USART3, USART_DMAREQ_RX | USART_DMAREQ_TX, ENABLE);
DMA_SetCurrDataCounter(U3_DMA_RECV_CH,20);
DMA_EnableChannel(U3_DMA_RECV_CH, ENABLE);
#define U3_DMA_SEND_CH DMA_CH5
#define U3_DMA_RECV_CH DMA_CH6
uint8_t u3_send_buff[20]={0};
uint8_t u3_recv_buff[20]={0};
DMA_InitType DMA_UART_TYPE;
DMA_DeInit(U3_DMA_SEND_CH);
DMA_UART_TYPE.BufSize=50;
DMA_UART_TYPE.CircularMode=DMA_MODE_NORMAL;
DMA_UART_TYPE.Direction=DMA_DIR_PERIPH_DST;
DMA_UART_TYPE.DMA_MemoryInc=DMA_MEM_INC_ENABLE;
DMA_UART_TYPE.Mem2Mem=DMA_M2M_DISABLE;
DMA_UART_TYPE.MemAddr=(uint32_t)u3_send_buff; //
DMA_UART_TYPE.MemDataSize=DMA_MemoryDataSize_Byte;
DMA_UART_TYPE.PeriphAddr=(u32)&(USART3->DAT);
DMA_UART_TYPE.PeriphDataSize=DMA_PERIPH_DATA_SIZE_BYTE;
DMA_UART_TYPE.PeriphInc=DMA_PERIPH_INC_DISABLE;
DMA_UART_TYPE.Priority=DMA_PRIORITY_VERY_HIGH;
DMA_Init(U3_DMA_SEND_CH,&DMA_UART_TYPE);
DMA_RequestRemap(DMA_REMAP_USART3_TX, DMA, U3_DMA_SEND_CH, ENABLE);
DMA_SetCurrDataCounter(U3_DMA_SEND_CH,20);
DMA_EnableChannel(U3_DMA_SEND_CH, ENABLE);
DMA_InitType DMA_UART_TYPE_1;
DMA_DeInit(U3_DMA_RECV_CH);
DMA_UART_TYPE_1.BufSize=50;
DMA_UART_TYPE_1.CircularMode=DMA_MODE_NORMAL;
DMA_UART_TYPE_1.Direction=DMA_DIR_PERIPH_SRC; //从外设到寄存器
DMA_UART_TYPE_1.DMA_MemoryInc=DMA_MEM_INC_ENABLE;
DMA_UART_TYPE_1.Mem2Mem=DMA_M2M_DISABLE;
DMA_UART_TYPE_1.MemAddr=(uint32_t)u3_recv_buff; //
DMA_UART_TYPE_1.MemDataSize=DMA_MemoryDataSize_Byte;
DMA_UART_TYPE_1.PeriphAddr=(u32)&(USART3->DAT);
DMA_UART_TYPE_1.PeriphDataSize=DMA_PERIPH_DATA_SIZE_BYTE;
DMA_UART_TYPE_1.PeriphInc=DMA_PERIPH_INC_DISABLE;
DMA_UART_TYPE_1.Priority=DMA_PRIORITY_VERY_HIGH;
DMA_Init(U3_DMA_RECV_CH,&DMA_UART_TYPE_1);
DMA_RequestRemap(DMA_REMAP_USART3_RX, DMA, U3_DMA_RECV_CH, ENABLE);
USART_EnableDMA(USART3, USART_DMAREQ_RX | USART_DMAREQ_TX, ENABLE);
DMA_SetCurrDataCounter(U3_DMA_RECV_CH,20);
DMA_EnableChannel(U3_DMA_RECV_CH, ENABLE);
|